Struct zeros::HashReader[][src]

pub struct HashReader<R> where
    R: Read
{ /* fields omitted */ }
👎 Deprecated:

Beta

Hash Reader

Notes

  • You can make this struct via Hash.

  • For each call to read():

    • The inner reader will be called first. If an error occurs, it will be returned. The hasher will not be updated.
    • Then the hasher will be updated.

Examples

use {
    std::io::Read,
    zeros::Hash,
};

const DATA: &[u8] = b"test";
const HASH: Hash = Hash::Sha3_256;

let mut buf = Vec::new();
let mut reader = HASH.new_reader(DATA);
reader.read_to_end(&mut buf)?;

let (hash, _) = reader.finish();
assert_eq!(hash, HASH.hash(DATA));
assert_eq!(buf, DATA);

Implementations

impl<R> HashReader<R> where
    R: Read
[src]

Trait Implementations

impl<R: Debug> Debug for HashReader<R> where
    R: Read
[src]

impl<R> Read for HashReader<R> where
    R: Read
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for HashReader<R> where
    R: RefUnwindSafe

impl<R> Send for HashReader<R> where
    R: Send

impl<R> Sync for HashReader<R> where
    R: Sync

impl<R> Unpin for HashReader<R> where
    R: Unpin

impl<R> UnwindSafe for HashReader<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.