roaring/bitmap/fmt.rs
1use core::fmt;
2
3use crate::RoaringBitmap;
4
5#[cfg(not(feature = "std"))]
6use alloc::vec::Vec;
7
8impl fmt::Debug for RoaringBitmap {
9 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10 if self.len() < 16 {
11 write!(f, "RoaringBitmap<{:?}>", self.iter().collect::<Vec<u32>>())
12 } else {
13 write!(
14 f,
15 "RoaringBitmap<{:?} values between {:?} and {:?} in {:?} containers>",
16 self.len(),
17 self.min().unwrap(),
18 self.max().unwrap(),
19 self.containers.len(),
20 )
21 }
22 }
23}