[][src]Trait basic_tar::ReadExt

pub trait ReadExt {
    fn try_read_exact(
        &mut self,
        buf: &mut [u8],
        pos_cb: impl FnMut(usize)
    ) -> Result<(), Error>;
fn try_drain(
        &mut self,
        len: usize,
        pos_cb: impl FnMut(usize)
    ) -> Result<(), Error>; }

An extension for Read

Required methods

fn try_read_exact(
    &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>

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

Loading content...

Implementors

impl<T: Read> ReadExt for T[src]

Loading content...