LtHash32

Struct LtHash32 

Source
pub struct LtHash32<H> { /* private fields */ }
Expand description

A LtHash checksum with 32 bits per chunk and 1024 chunks.

Implementations§

Source§

impl<H> LtHash32<H>

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<'a, H> BitOr for &'a LtHash32<H>

Source§

type Output = LtHash32<H>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<H> BitOr for LtHash32<H>

Source§

type Output = LtHash32<H>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<H: Clone> Clone for LtHash32<H>

Source§

fn clone(&self) -> LtHash32<H>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<H> Debug for LtHash32<H>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<H> Default for LtHash32<H>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<A, H> Extend<A> for LtHash32<H>
where A: AsRef<[u8]>, H: ExtendableOutput + Default,

Source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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>
where A: AsRef<[u8]>, H: ExtendableOutput + Default,

Source§

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>

Source§

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]>)

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

Provides the hex value as String of the checksum.

Source§

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

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"]));
Source§

fn reset(&mut self)

Clears the internal checksum

Source§

fn into_bytes(self) -> Vec<u8>

Converts self into the inner list of bytes

Source§

impl<H> PartialEq for LtHash32<H>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, H> Sub for &'a LtHash32<H>

Source§

type Output = LtHash32<H>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<H> Sub for LtHash32<H>

Source§

type Output = LtHash32<H>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<H> TryFrom<&[u8]> for LtHash32<H>

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.