pub type BlockNumberList = IntegerList;Expand description
List with transaction numbers.
Aliased Type§
pub struct BlockNumberList(pub RoaringTreemap);Tuple Fields§
§0: RoaringTreemapMethods from Deref<Target = RoaringTreemap>§
pub fn is_disjoint(&self, other: &RoaringTreemap) -> bool
pub fn is_disjoint(&self, other: &RoaringTreemap) -> bool
Returns true if the set has no elements in common with other. This is equivalent to checking for an empty intersection.
§Examples
use roaring::RoaringTreemap;
let mut rb1 = RoaringTreemap::new();
let mut rb2 = RoaringTreemap::new();
rb1.insert(1);
assert_eq!(rb1.is_disjoint(&rb2), true);
rb2.insert(1);
assert_eq!(rb1.is_disjoint(&rb2), false);
pub fn is_subset(&self, other: &RoaringTreemap) -> bool
pub fn is_subset(&self, other: &RoaringTreemap) -> bool
Returns true if this set is a subset of other.
§Examples
use roaring::RoaringTreemap;
let mut rb1 = RoaringTreemap::new();
let mut rb2 = RoaringTreemap::new();
rb1.insert(1);
assert_eq!(rb1.is_subset(&rb2), false);
rb2.insert(1);
assert_eq!(rb1.is_subset(&rb2), true);
rb1.insert(2);
assert_eq!(rb1.is_subset(&rb2), false);pub fn is_superset(&self, other: &RoaringTreemap) -> bool
pub fn is_superset(&self, other: &RoaringTreemap) -> bool
Returns true if this set is a superset of other.
§Examples
use roaring::RoaringTreemap;
let mut rb1 = RoaringTreemap::new();
let mut rb2 = RoaringTreemap::new();
rb1.insert(1);
assert_eq!(rb2.is_superset(&rb1), false);
rb2.insert(1);
assert_eq!(rb2.is_superset(&rb1), true);
rb1.insert(2);
assert_eq!(rb2.is_superset(&rb1), false);pub fn contains(&self, value: u64) -> bool
pub fn contains(&self, value: u64) -> bool
Returns true if this set contains the specified integer.
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
rb.insert(1);
assert_eq!(rb.contains(0), false);
assert_eq!(rb.contains(1), true);
assert_eq!(rb.contains(100), false);pub fn contains_range<R>(&self, range: R) -> boolwhere
R: RangeBounds<u64>,
pub fn contains_range<R>(&self, range: R) -> boolwhere
R: RangeBounds<u64>,
Returns true if all values in the range are present in this set.
An empty range is always contained.
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
// An empty range is always contained
assert!(rb.contains_range(7..7));
rb.insert_range(1..0x1_0000_0000);
assert!(rb.contains_range(1..0x1_0000_0000));
assert!(rb.contains_range(2..0x1_0000_0000));
// 0 is not contained
assert!(!rb.contains_range(0..2));
// 0x1_0000_0000 is not contained
assert!(!rb.contains_range(1..=0x1_0000_0000));pub fn range_cardinality<R>(&self, range: R) -> u64where
R: RangeBounds<u64>,
pub fn range_cardinality<R>(&self, range: R) -> u64where
R: RangeBounds<u64>,
Returns the number of elements in this set which are in the passed range.
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
rb.insert_range(0x1_0000_0000..0x4_0000_0000);
rb.insert(0x5_0000_0001);
rb.insert(0x5_0000_0005);
rb.insert(u64::MAX);
assert_eq!(rb.range_cardinality(0..0x1_0000_0000), 0);
assert_eq!(rb.range_cardinality(0x1_0000_0000..0x4_0000_0000), 0x3_0000_0000);
assert_eq!(rb.range_cardinality(0x5_0000_0000..0x6_0000_0000), 2);
assert_eq!(rb.range_cardinality(0x1_0000_0000..0x1_0000_0000), 0);
assert_eq!(rb.range_cardinality(0x5_0000_0000..=u64::MAX), 3);pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are no integers in this set.
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.is_empty(), true);
rb.insert(3);
assert_eq!(rb.is_empty(), false);pub fn len(&self) -> u64
pub fn len(&self) -> u64
Returns the number of distinct integers added to the set.
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.len(), 0);
rb.insert(3);
assert_eq!(rb.len(), 1);
rb.insert(3);
rb.insert(4);
assert_eq!(rb.len(), 2);pub fn min(&self) -> Option<u64>
pub fn min(&self) -> Option<u64>
Returns the minimum value in the set (if the set is non-empty).
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.min(), None);
rb.insert(3);
rb.insert(4);
assert_eq!(rb.min(), Some(3));pub fn max(&self) -> Option<u64>
pub fn max(&self) -> Option<u64>
Returns the maximum value in the set (if the set is non-empty).
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.max(), None);
rb.insert(3);
rb.insert(4);
assert_eq!(rb.max(), Some(4));pub fn rank(&self, value: u64) -> u64
pub fn rank(&self, value: u64) -> u64
Returns the number of integers that are <= value. rank(u64::MAX) == len()
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.rank(0), 0);
rb.insert(3);
rb.insert(4);
assert_eq!(rb.rank(3), 1);
assert_eq!(rb.rank(10), 2)pub fn select(&self, n: u64) -> Option<u64>
pub fn select(&self, n: u64) -> Option<u64>
Returns the nth integer in the set or None if n >= len()
§Examples
use roaring::RoaringTreemap;
let mut rb = RoaringTreemap::new();
assert_eq!(rb.select(0), None);
rb.append(vec![0, 10, 100]);
assert_eq!(rb.select(0), Some(0));
assert_eq!(rb.select(1), Some(10));
assert_eq!(rb.select(2), Some(100));
assert_eq!(rb.select(3), None);pub fn iter(&self) -> Iter<'_> ⓘ
pub fn iter(&self) -> Iter<'_> ⓘ
Iterator over each value stored in the RoaringTreemap, guarantees values are ordered by value.
§Examples
use roaring::RoaringTreemap;
use core::iter::FromIterator;
let bitmap = (1..3).collect::<RoaringTreemap>();
let mut iter = bitmap.iter();
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), None);pub fn bitmaps(&self) -> BitmapIter<'_> ⓘ
pub fn bitmaps(&self) -> BitmapIter<'_> ⓘ
Iterator over pairs of partition number and the corresponding RoaringBitmap. The partition number is defined by the 32 most significant bits of the bit index.
§Examples
use roaring::{RoaringBitmap, RoaringTreemap};
use core::iter::FromIterator;
let original = (0..6000).collect::<RoaringTreemap>();
let mut bitmaps = original.bitmaps();
assert_eq!(bitmaps.next(), Some((0, &(0..6000).collect::<RoaringBitmap>())));
assert_eq!(bitmaps.next(), None);pub fn union_len(&self, other: &RoaringTreemap) -> u64
pub fn union_len(&self, other: &RoaringTreemap) -> u64
Computes the len of the union with the specified other treemap without creating a new treemap.
This is faster and more space efficient when you’re only interested in the cardinality of the union.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let rb2: RoaringTreemap = (3..5).collect();
assert_eq!(rb1.union_len(&rb2), (rb1 | rb2).len());pub fn intersection_len(&self, other: &RoaringTreemap) -> u64
pub fn intersection_len(&self, other: &RoaringTreemap) -> u64
Computes the len of the intersection with the specified other treemap without creating a new treemap.
This is faster and more space efficient when you’re only interested in the cardinality of the intersection.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let rb2: RoaringTreemap = (3..5).collect();
assert_eq!(rb1.intersection_len(&rb2), (rb1 & rb2).len());pub fn difference_len(&self, other: &RoaringTreemap) -> u64
pub fn difference_len(&self, other: &RoaringTreemap) -> u64
Computes the len of the difference with the specified other treemap without creating a new treemap.
This is faster and more space efficient when you’re only interested in the cardinality of the difference.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let rb2: RoaringTreemap = (3..5).collect();
assert_eq!(rb1.difference_len(&rb2), (rb1 - rb2).len());pub fn symmetric_difference_len(&self, other: &RoaringTreemap) -> u64
pub fn symmetric_difference_len(&self, other: &RoaringTreemap) -> u64
Computes the len of the symmetric difference with the specified other treemap without creating a new bitmap.
This is faster and more space efficient when you’re only interested in the cardinality of the symmetric difference.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let rb2: RoaringTreemap = (3..5).collect();
assert_eq!(rb1.symmetric_difference_len(&rb2), (rb1 ^ rb2).len());pub fn serialized_size(&self) -> usize
pub fn serialized_size(&self) -> usize
Return the size in bytes of the serialized output. This is compatible with the official C/C++, Java and Go implementations.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let mut bytes = Vec::with_capacity(rb1.serialized_size());
rb1.serialize_into(&mut bytes).unwrap();
let rb2 = RoaringTreemap::deserialize_from(&bytes[..]).unwrap();
assert_eq!(rb1, rb2);pub fn serialize_into<W>(&self, writer: W) -> Result<(), Error>where
W: Write,
pub fn serialize_into<W>(&self, writer: W) -> Result<(), Error>where
W: Write,
Serialize this bitmap. This is compatible with the official C/C++, Java and Go implementations.
§Examples
use roaring::RoaringTreemap;
let rb1: RoaringTreemap = (1..4).collect();
let mut bytes = vec![];
rb1.serialize_into(&mut bytes).unwrap();
let rb2 = RoaringTreemap::deserialize_from(&bytes[..]).unwrap();
assert_eq!(rb1, rb2);Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes