[−][src]Trait basic_tar::ReadExt
An extension for Read
Required methods
fn try_read_exact(
&mut self,
buf: &mut [u8],
pos_cb: impl FnMut(usize)
) -> Result<(), Error>
&mut self,
buf: &mut [u8],
pos_cb: impl FnMut(usize)
) -> Result<(), Error>
Tries to fill buf
completely and calls the position callback pos_cb
with the amount of
bytes read on every successful read
call
Note: This function behaves like read_exact
, except that you will never loose state in
case of an incomplete read - if the error is non-fatal (like TimedOut
), you can always try
again later if nothing happened
fn try_drain(
&mut self,
len: usize,
pos_cb: impl FnMut(usize)
) -> Result<(), Error>
&mut self,
len: usize,
pos_cb: impl FnMut(usize)
) -> Result<(), Error>
Tries to consume len
bytes and calls the position callback pos_cb
with the amount of
bytes drained on every successful read
call
Note: This function behaves similar to read_exact
(without buffer), except that you will
never loose state in case of an incomplete write - if the error is non-fatal (like
TimedOut
), you can always try again later if nothing happened