pub struct RoaringBitmap { /* private fields */ }Expand description
A compressed bitset for u32 values using the Roaring Bitmap format.
§Example
use akar_storage::roaring_bitmap::RoaringBitmap;
let mut rb = RoaringBitmap::new();
rb.add(42);
rb.add(100000);
assert!(rb.contains(42));
assert!(!rb.contains(0));
assert_eq!(rb.len(), 2);Implementations§
Source§impl RoaringBitmap
impl RoaringBitmap
Sourcepub fn from_sorted(values: &[u32]) -> Self
pub fn from_sorted(values: &[u32]) -> Self
Create a bitmap from a sorted Vec<u32>.
Sourcepub fn add(&mut self, value: u32) -> bool
pub fn add(&mut self, value: u32) -> bool
Insert a value. Returns true if the value was newly added.
Sourcepub fn remove(&mut self, value: u32) -> bool
pub fn remove(&mut self, value: u32) -> bool
Remove a value. Returns true if the value was present.
Sourcepub fn union_with(&mut self, other: &RoaringBitmap)
pub fn union_with(&mut self, other: &RoaringBitmap)
Union with another bitmap in-place.
Sourcepub fn intersect_with(&mut self, other: &RoaringBitmap)
pub fn intersect_with(&mut self, other: &RoaringBitmap)
Intersection with another bitmap in-place.
Sourcepub fn difference_with(&mut self, other: &RoaringBitmap)
pub fn difference_with(&mut self, other: &RoaringBitmap)
Difference with another bitmap in-place (self = self \ other).
Sourcepub fn union(&self, other: &RoaringBitmap) -> RoaringBitmap
pub fn union(&self, other: &RoaringBitmap) -> RoaringBitmap
Return a new bitmap as the union of self and other.
Sourcepub fn intersection(&self, other: &RoaringBitmap) -> RoaringBitmap
pub fn intersection(&self, other: &RoaringBitmap) -> RoaringBitmap
Return a new bitmap as the intersection of self and other.
Sourcepub fn difference(&self, other: &RoaringBitmap) -> RoaringBitmap
pub fn difference(&self, other: &RoaringBitmap) -> RoaringBitmap
Return a new bitmap as the difference of self and other.
Sourcepub fn iter(&self) -> RoaringIter<'_> ⓘ
pub fn iter(&self) -> RoaringIter<'_> ⓘ
Iterator over all values in sorted order.
Trait Implementations§
Source§impl Clone for RoaringBitmap
impl Clone for RoaringBitmap
Source§fn clone(&self) -> RoaringBitmap
fn clone(&self) -> RoaringBitmap
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RoaringBitmap
impl Debug for RoaringBitmap
Auto Trait Implementations§
impl Freeze for RoaringBitmap
impl RefUnwindSafe for RoaringBitmap
impl Send for RoaringBitmap
impl Sync for RoaringBitmap
impl Unpin for RoaringBitmap
impl UnsafeUnpin for RoaringBitmap
impl UnwindSafe for RoaringBitmap
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more