pub struct Signature<R> { /* private fields */ }
Expand description
A struct to generate a signature.
This type takes a Read
stream for the input from which compute the signatures, and implements
another Read
stream from which get the result.
Implementations§
source§impl<R: Read> Signature<BufReader<R>>
impl<R: Read> Signature<BufReader<R>>
sourcepub fn new(input: R) -> Result<Self>
pub fn new(input: R) -> Result<Self>
Creates a new signature stream with default parameters.
This constructor takes an input stream for the file from which compute the signatures. Default options are used for the signature format: BLAKE2 for the hashing, 2048 bytes for the block length and full length for the strong signature size.
sourcepub fn with_options(
input: R,
block_len: usize,
strong_len: usize,
sig_magic: SignatureType
) -> Result<Self>
pub fn with_options( input: R, block_len: usize, strong_len: usize, sig_magic: SignatureType ) -> Result<Self>
Creates a new signature stream by specifying custom parameters.
This constructor takes the input stream for the file from which compute the signatures, the
size of checksum blocks as block_len
parameter (larger values make the signature shorter
and the delta longer), and the size of strong signatures in bytes as strong_len
parameter. If it is non-zero the signature will be truncated to that amount of bytes.
The last parameter specifies which version of the signature format to be used.
source§impl<R: BufRead> Signature<R>
impl<R: BufRead> Signature<R>
sourcepub fn with_buf_read(
input: R,
block_len: usize,
strong_len: usize,
sig_magic: SignatureType
) -> Result<Self>
pub fn with_buf_read( input: R, block_len: usize, strong_len: usize, sig_magic: SignatureType ) -> Result<Self>
Creates a new signature stream by using a BufRead
.
This constructor takes an already built BufRead
instance. Prefer this constructor if
you already have a BufRead
as input stream, since it avoids wrapping the input stream
into another BufRead
instance. See with_options
constructor for details on the other
parameters.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this stream, returning the underlying input stream.
Trait Implementations§
source§impl<R: BufRead> Read for Signature<R>
impl<R: BufRead> Read for Signature<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, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> 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