pub struct HashWriter<D: Digest, W: Write> { /* private fields */ }Expand description
Abstraction over a writer which hashes the data being written.
Implementations§
Source§impl<D: Digest, W: Write> HashWriter<D, W>
impl<D: Digest, W: Write> HashWriter<D, W>
Sourcepub fn new_from_parts(hasher: D, writer: W) -> Self
pub fn new_from_parts(hasher: D, writer: W) -> Self
Construct a new HashWriter given an existing hasher and writer by value.
Sourcepub fn replace_writer(&mut self, writer: W)
pub fn replace_writer(&mut self, writer: W)
Replace the writer with another writer
Sourcepub fn get_hasher(&self) -> &D
pub fn get_hasher(&self) -> &D
Gets a reference to the underlying hasher
Sourcepub fn get_writer(&self) -> &W
pub fn get_writer(&self) -> &W
Gets a reference to the underlying writer
Sourcepub fn get_hasher_mut(&mut self) -> &mut D
pub fn get_hasher_mut(&mut self) -> &mut D
Gets a mutable reference to the underlying hasher Updates to the digest are not written to the underlying writer
Sourcepub fn get_writer_mut(&mut self) -> &mut W
pub fn get_writer_mut(&mut self) -> &mut W
Gets a mutable reference to the underlying writer Direct writes to the underlying writer are not hashed
Sourcepub fn into_hasher(self) -> D
pub fn into_hasher(self) -> D
Consume the HashWriter and return its hasher
Sourcepub fn into_inner_writer(self) -> W
pub fn into_inner_writer(self) -> W
Consume the HashWriter and return its internal writer
Sourcepub fn into_parts(self) -> (D, W)
pub fn into_parts(self) -> (D, W)
Consume the HashWriter and return its hasher and internal writer
Sourcepub fn finalize_into(self, out: &mut Output<D>)
pub fn finalize_into(self, out: &mut Output<D>)
Write result into provided array and consume the HashWriter instance.
Sourcepub fn output_size() -> usize
pub fn output_size() -> usize
Get output size of the hasher
Source§impl<D: Digest + FixedOutputReset, W: Write> HashWriter<D, W>
impl<D: Digest + FixedOutputReset, W: Write> HashWriter<D, W>
Sourcepub fn finalize_reset(&mut self) -> Output<D>
pub fn finalize_reset(&mut self) -> Output<D>
Retrieve result and reset hasher instance.
Sourcepub fn finalize_into_reset(&mut self, out: &mut Output<D>)
pub fn finalize_into_reset(&mut self, out: &mut Output<D>)
Write result into provided array and reset the hasher instance.
Trait Implementations§
Source§impl<D: Digest + Clone, W: Write + Clone> Clone for HashWriter<D, W>
impl<D: Digest + Clone, W: Write + Clone> Clone for HashWriter<D, W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D: Digest, W: Write> Write for HashWriter<D, W>
impl<D: Digest, W: Write> Write for HashWriter<D, W>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)