pub struct HashReader<D: Digest, R: Read> { /* private fields */ }Expand description
Abstraction over a reader which hashes the data being read
Implementations§
Source§impl<D: Digest, R: Read> HashReader<D, R>
impl<D: Digest, R: Read> HashReader<D, R>
Sourcepub fn new_from_parts(hasher: D, reader: R) -> Self
pub fn new_from_parts(hasher: D, reader: R) -> Self
Construct a new HashReader given an existing hasher and reader by value.
Sourcepub fn replace_reader(&mut self, reader: R)
pub fn replace_reader(&mut self, reader: R)
Replace the reader with another reader
Sourcepub fn get_hasher(&self) -> &D
pub fn get_hasher(&self) -> &D
Gets a reference to the underlying hasher
Sourcepub fn get_reader(&self) -> &R
pub fn get_reader(&self) -> &R
Gets a reference to the underlying reader
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
Sourcepub fn get_reader_mut(&mut self) -> &mut R
pub fn get_reader_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader Direct reads from the underlying reader are not hashed
Sourcepub fn into_hasher(self) -> D
pub fn into_hasher(self) -> D
Consume the HashReader and return its hasher
Sourcepub fn into_inner_reader(self) -> R
pub fn into_inner_reader(self) -> R
Consume the HashReader and return its internal reader
Sourcepub fn into_parts(self) -> (D, R)
pub fn into_parts(self) -> (D, R)
Consume the HashReader and return its hasher and internal reader
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 HashReader instance.
Sourcepub fn output_size() -> usize
pub fn output_size() -> usize
Get output size of the hasher
Source§impl<D: Digest + FixedOutputReset, R: Read> HashReader<D, R>
impl<D: Digest + FixedOutputReset, R: Read> HashReader<D, R>
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>)
Rrite result into provided array and reset the hasher instance.
Source§impl<D: Digest, R: BufRead> HashReader<D, R>
impl<D: Digest, R: BufRead> HashReader<D, R>
Sourcepub fn hash_to_end(&mut self)
pub fn hash_to_end(&mut self)
Read and hash all bytes remaining in the reader, discarding the data Based on implementation in b2sum crate, MIT License Copyright (c) 2017 John Downey
Trait Implementations§
Source§impl<D: Digest + Clone, R: Read + Clone> Clone for HashReader<D, R>
impl<D: Digest + Clone, R: Read + Clone> Clone for HashReader<D, R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D: Digest, R: Read> Read for HashReader<D, R>
impl<D: Digest, R: Read> Read for HashReader<D, R>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more