pub struct LtHash32<H> { /* private fields */ }Expand description
A LtHash checksum with 32 bits per chunk and 1024 chunks.
Implementations§
Trait Implementations§
Source§impl<A, H> Extend<A> for LtHash32<H>
impl<A, H> Extend<A> for LtHash32<H>
Source§fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<A, H> FromIterator<A> for LtHash32<H>
impl<A, H> FromIterator<A> for LtHash32<H>
Source§fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<H> LtHash for LtHash32<H>where
H: ExtendableOutput + Default,
impl<H> LtHash for LtHash32<H>where
H: ExtendableOutput + Default,
Source§fn insert(&mut self, element: impl AsRef<[u8]>)
fn insert(&mut self, element: impl AsRef<[u8]>)
Inserts an element to LtHash, actually it generates the hash (of size 4096 bytes) of the object and sums it to the checksum.
Source§fn remove(&mut self, element: impl AsRef<[u8]>)
fn remove(&mut self, element: impl AsRef<[u8]>)
Removes an element to LtHash, actually it generates the hash (of size 4096 bytes) of the object and removes it from the checksum.
Source§fn to_hex_string(&self) -> String
fn to_hex_string(&self) -> String
Provides the hex value as String of the checksum.
Source§fn union(&self, rhs: &Self) -> Self
fn union(&self, rhs: &Self) -> Self
Takes the union of self and rhs
Equivalent to cloning self, then adding all the objects in rhs.
Equivalent to self | other
§Examples
let mut left = LtHash32::<Shake256>::new();
left.insert("hello");
let mut right = LtHash32::<Shake256>::new();
right.insert("world");
assert_eq!(left.union(&right), LtHash32::<Shake256>::from_iter(&["hello", "world"]));Source§fn difference(&self, rhs: &Self) -> Self
fn difference(&self, rhs: &Self) -> Self
Takes the difference of self and rhs.
Equivalent to cloning self, then removing all the objects in rhs.
Equivalent to self - other
§Examples
let mut left = LtHash32::<Shake256>::new();
left.extend(&["hello", "world"]);
let mut right = LtHash32::<Shake256>::new();
right.insert("hello");
assert_eq!(left.difference(&right), LtHash32::from_iter(&["world"]));impl<H: Copy> Copy for LtHash32<H>
Auto Trait Implementations§
impl<H> Freeze for LtHash32<H>
impl<H> RefUnwindSafe for LtHash32<H>where
H: RefUnwindSafe,
impl<H> Send for LtHash32<H>where
H: Send,
impl<H> Sync for LtHash32<H>where
H: Sync,
impl<H> Unpin for LtHash32<H>where
H: Unpin,
impl<H> UnwindSafe for LtHash32<H>where
H: 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