LtHash

Trait LtHash 

Source
pub trait LtHash {
    // Required methods
    fn insert(&mut self, element: impl AsRef<[u8]>);
    fn remove(&mut self, element: impl AsRef<[u8]>);
    fn to_hex_string(&self) -> String;
    fn union(&self, rhs: &Self) -> Self;
    fn difference(&self, rhs: &Self) -> Self;
    fn reset(&mut self);
    fn into_bytes(self) -> Vec<u8> ;
}
Expand description

Generic trait for LtHash, these functions will be implemented by all the instances of LtHash.

Required Methods§

Source

fn insert(&mut self, element: impl AsRef<[u8]>)

Inserts an element to LtHash, actually it generates the hash (of size 2048 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 2048 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.

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.

Source

fn reset(&mut self)

Clears the internal checksum.

Source

fn into_bytes(self) -> Vec<u8>

Converts self into the inner list of bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§