pub struct Sha256Hash(/* private fields */);Expand description
A Sha256 hash.
Certain entities use this kind of hash as a key. It’s a small value which lives on the stack, as opposed to the longer, heap-allocated values which it replaces.
This type enables this use case with the new entity traits.
Implementations§
Source§impl Sha256Hash
impl Sha256Hash
Sourcepub fn hash_from(input: impl AsRef<[u8]>) -> Self
pub fn hash_from(input: impl AsRef<[u8]>) -> Self
Create an instance by hashing a single input value.
Sourcepub fn from_existing_hash(hash: impl AsRef<[u8]>) -> CryptoKeystoreResult<Self>
pub fn from_existing_hash(hash: impl AsRef<[u8]>) -> CryptoKeystoreResult<Self>
Convert an existing hash into an instance of this type.
Only basic length checking is performed!
Trait Implementations§
Source§impl<__AsT: ?Sized> AsRef<__AsT> for Sha256Hash
impl<__AsT: ?Sized> AsRef<__AsT> for Sha256Hash
Source§impl Clone for Sha256Hash
impl Clone for Sha256Hash
Source§fn clone(&self) -> Sha256Hash
fn clone(&self) -> Sha256Hash
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 Debug for Sha256Hash
impl Debug for Sha256Hash
Source§impl Default for Sha256Hash
impl Default for Sha256Hash
Source§fn default() -> Sha256Hash
fn default() -> Sha256Hash
Returns the “default value” for a type. Read more
Source§impl Deref for Sha256Hash
impl Deref for Sha256Hash
Source§impl Display for Sha256Hash
impl Display for Sha256Hash
Source§impl From<Sha256Hash> for [u8; 32]
impl From<Sha256Hash> for [u8; 32]
Source§fn from(value: Sha256Hash) -> Self
fn from(value: Sha256Hash) -> Self
Converts to this type from the input type.
Source§impl Hash for Sha256Hash
impl Hash for Sha256Hash
Source§impl KeyType for Sha256Hash
impl KeyType for Sha256Hash
Source§impl Ord for Sha256Hash
impl Ord for Sha256Hash
Source§fn cmp(&self, other: &Sha256Hash) -> Ordering
fn cmp(&self, other: &Sha256Hash) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Sha256Hash
impl PartialEq for Sha256Hash
Source§impl PartialOrd for Sha256Hash
impl PartialOrd for Sha256Hash
Source§impl ToSql for Sha256Hash
Available on non-target_family=wasm only.
impl ToSql for Sha256Hash
Available on non-
target_family=wasm only.impl Copy for Sha256Hash
impl Eq for Sha256Hash
impl StructuralPartialEq for Sha256Hash
Auto Trait Implementations§
impl Freeze for Sha256Hash
impl RefUnwindSafe for Sha256Hash
impl Send for Sha256Hash
impl Sync for Sha256Hash
impl Unpin for Sha256Hash
impl UnwindSafe for Sha256Hash
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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§impl<T> SqlFnOutput for Twhere
T: ToSql,
impl<T> SqlFnOutput for Twhere
T: ToSql,
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)