Trait stdto_core::ToHash

source ·
pub trait ToHash: ToBytes {
    fn try_to_hash<T: Digest + Write>(&self) -> Result<Output<T>>
    where
        Self: Serialize
, { ... } fn try_to_hash_into<T: Digest + Write>(&self, hasher: &mut T) -> Result<()>
    where
        Self: Serialize
, { ... } fn to_hash<T: Digest + Write>(&self) -> Output<T>
    where
        Self: Serialize
, { ... } fn to_hash_into<T: Digest + Write>(&self, hasher: &mut T)
    where
        Self: Serialize
, { ... } }
Expand description

Provided Methods§

Examples found in repository?
src/traits.rs (line 374)
369
370
371
372
373
374
375
376
    fn try_to_hash<T: Digest + io::Write>(&self) -> Result<Output<T>>
    where
        Self: Serialize,
    {
        let mut hasher = T::new();
        self.try_to_hash_into(&mut hasher)?;
        Ok(hasher.finalize())
    }
Examples found in repository?
src/traits.rs (line 390)
385
386
387
388
389
390
391
392
    fn to_hash<T: Digest + io::Write>(&self) -> Output<T>
    where
        Self: Serialize,
    {
        let mut hasher = T::new();
        self.to_hash_into(&mut hasher);
        hasher.finalize()
    }

Implementors§