pub struct SplinterRef<T> { /* private fields */ }Expand description
A compressed bitmap for u32 keys operating directly on a slice of bytes
Implementations§
Source§impl<T> SplinterRef<T>
impl<T> SplinterRef<T>
pub fn from_bytes(data: T) -> Result<Self, Culprit<DecodeErr>>
pub fn size(&self) -> usize
pub fn inner(&self) -> &T
pub fn into_inner(self) -> T
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the splinter is empty.
§Examples
let mut splinter = Splinter::default().serialize_to_splinter_ref();
assert!(splinter.is_empty());
let mut splinter = Splinter::default();
splinter.insert(1);
let splinter = splinter.serialize_to_splinter_ref();
assert!(!splinter.is_empty());Sourcepub fn contains(&self, key: u32) -> bool
pub fn contains(&self, key: u32) -> bool
Returns true if the splinter contains the given key.
§Examples
let mut splinter = Splinter::default();
splinter.insert(1);
splinter.insert(3);
let splinter = splinter.serialize_to_splinter_ref();
assert!(splinter.contains(1));
assert!(!splinter.contains(2));
assert!(splinter.contains(3));Sourcepub fn cardinality(&self) -> usize
pub fn cardinality(&self) -> usize
Calculates the total number of values stored in the set.
§Examples
let mut splinter = Splinter::default();
splinter.insert(6);
splinter.insert(1);
splinter.insert(3);
let splinter = splinter.serialize_to_splinter_ref();
assert_eq!(3, splinter.cardinality());Trait Implementations§
Source§impl<T: Clone> Clone for SplinterRef<T>
impl<T: Clone> Clone for SplinterRef<T>
Source§fn clone(&self) -> SplinterRef<T>
fn clone(&self) -> SplinterRef<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: AsRef<[u8]>> From<SplinterRef<T>> for Splinter
impl<T: AsRef<[u8]>> From<SplinterRef<T>> for Splinter
Source§fn from(value: SplinterRef<T>) -> Self
fn from(value: SplinterRef<T>) -> Self
Converts to this type from the input type.
Source§impl<T: AsRef<[u8]>> Intersection<Splinter> for SplinterRef<T>
impl<T: AsRef<[u8]>> Intersection<Splinter> for SplinterRef<T>
Source§impl<T: AsRef<[u8]>> Intersection<SplinterRef<T>> for Splinter
impl<T: AsRef<[u8]>> Intersection<SplinterRef<T>> for Splinter
type Output = Splinter
Source§fn intersection(&self, rhs: &SplinterRef<T>) -> Self::Output
fn intersection(&self, rhs: &SplinterRef<T>) -> Self::Output
Returns the intersection between self and other
Source§impl<T1: AsRef<[u8]>, T2: AsRef<[u8]>> Intersection<SplinterRef<T2>> for SplinterRef<T1>
impl<T1: AsRef<[u8]>, T2: AsRef<[u8]>> Intersection<SplinterRef<T2>> for SplinterRef<T1>
type Output = Splinter
Source§fn intersection(&self, rhs: &SplinterRef<T2>) -> Self::Output
fn intersection(&self, rhs: &SplinterRef<T2>) -> Self::Output
Returns the intersection between self and other
Source§impl<T: AsRef<[u8]>> Merge<SplinterRef<T>> for Splinter
impl<T: AsRef<[u8]>> Merge<SplinterRef<T>> for Splinter
Source§fn merge(&mut self, rhs: &SplinterRef<T>)
fn merge(&mut self, rhs: &SplinterRef<T>)
Merges rhs into self
Source§impl<T1: AsRef<[u8]>, T2: AsRef<[u8]>> PartialEq<SplinterRef<T2>> for SplinterRef<T1>
impl<T1: AsRef<[u8]>, T2: AsRef<[u8]>> PartialEq<SplinterRef<T2>> for SplinterRef<T1>
Auto Trait Implementations§
impl<T> Freeze for SplinterRef<T>where
T: Freeze,
impl<T> RefUnwindSafe for SplinterRef<T>where
T: RefUnwindSafe,
impl<T> Send for SplinterRef<T>where
T: Send,
impl<T> Sync for SplinterRef<T>where
T: Sync,
impl<T> Unpin for SplinterRef<T>where
T: Unpin,
impl<T> UnwindSafe for SplinterRef<T>where
T: UnwindSafe,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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