Struct zeros::HashWriter[][src]

pub struct HashWriter<W> where
    W: Write
{ /* fields omitted */ }
👎 Deprecated:

Beta

Hash Writer

Notes

  • You can make this struct via Hash.

  • For each call to write():

    • The inner writer 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::Write,
    zeros::Hash,
};

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

let mut writer = HASH.new_writer(Vec::new());
writer.write_all(DATA)?;

let (hash, mut buf) = writer.finish();
buf.flush()?;

assert_eq!(hash, HASH.hash(DATA));
assert_eq!(buf, DATA);

Implementations

impl<W> HashWriter<W> where
    W: Write
[src]

pub fn finish(self) -> (Vec<u8>, W)[src]

👎 Deprecated:

Beta

Finishes and returns hash and the inner writer

The inner writer will not be flushed.

pub fn finish_as_hex(self) -> (String, W)[src]

👎 Deprecated:

Beta

Trait Implementations

impl<W: Debug> Debug for HashWriter<W> where
    W: Write
[src]

impl<W> Write for HashWriter<W> where
    W: Write
[src]

Auto Trait Implementations

impl<W> RefUnwindSafe for HashWriter<W> where
    W: RefUnwindSafe

impl<W> Send for HashWriter<W> where
    W: Send

impl<W> Sync for HashWriter<W> where
    W: Sync

impl<W> Unpin for HashWriter<W> where
    W: Unpin

impl<W> UnwindSafe for HashWriter<W> where
    W: 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.