#[repr(transparent)]pub struct Hash(pub [u8; 32]);
Expand description
A hash wrapper.
A hash is often provided as string composed of 64 hexadecimal character (0 to 9 then A to F).
Tuple Fields§
§0: [u8; 32]
Implementations§
Source§impl Hash
impl Hash
Sourcepub const SIZE_IN_BYTES: usize = 32usize
pub const SIZE_IN_BYTES: usize = 32usize
Hash size (in bytes).
Sourcepub fn random() -> Result<Self, UnspecifiedRandError>
pub fn random() -> Result<Self, UnspecifiedRandError>
Generate a random Hash
Sourcepub fn compute_multipart(data_parts: &[&[u8]]) -> Hash
pub fn compute_multipart(data_parts: &[&[u8]]) -> Hash
Compute SHA256 hash of any binary data on several parts
Sourcepub fn compute_blake3(datas: &[u8]) -> Hash
pub fn compute_blake3(datas: &[u8]) -> Hash
Compute BLAKE3 hash of any binary datas
Sourcepub fn to_bytes_vector(&self) -> Vec<u8> ⓘ
pub fn to_bytes_vector(&self) -> Vec<u8> ⓘ
Convert Hash into bytes vector
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Hash
impl Ord for Hash
Source§impl PartialOrd for Hash
impl PartialOrd for Hash
impl Copy for Hash
impl Eq for Hash
impl FromBytes for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)