Struct buffered_reader::Limitor[][src]

pub struct Limitor<T: BufferedReader<C>, C: Debug + Sync + Send> { /* fields omitted */ }

Limits the amount of data that can be read from a BufferedReader.

Implementations

impl<T: BufferedReader<()>> Limitor<T, ()>[src]

pub fn new(reader: T, limit: u64) -> Self[src]

Instantiates a new limitor.

reader is the source to wrap. limit is the maximum number of bytes that can be read from the source.

impl<T: BufferedReader<C>, C: Debug + Sync + Send> Limitor<T, C>[src]

Like new(), but sets a cookie.

The cookie can be retrieved using the cookie_ref and cookie_mut methods, and set using the cookie_set method.

Trait Implementations

impl<T: BufferedReader<C>, C: Debug + Sync + Send> BufferedReader<C> for Limitor<T, C>[src]

fn data(&mut self, amount: usize) -> Result<&[u8], Error>[src]

Return the buffer. Ensure that it contains at least amount bytes.

impl<T: Debug + BufferedReader<C>, C: Debug + Sync + Send> Debug for Limitor<T, C>[src]

impl<T: BufferedReader<C>, C: Debug + Sync + Send> Display for Limitor<T, C>[src]

impl<T: BufferedReader<C>, C: Debug + Sync + Send> Read for Limitor<T, C>[src]

Auto Trait Implementations

impl<T, C> RefUnwindSafe for Limitor<T, C> where
    C: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, C> Send for Limitor<T, C>

impl<T, C> Sync for Limitor<T, C>

impl<T, C> Unpin for Limitor<T, C> where
    C: Unpin,
    T: Unpin

impl<T, C> UnwindSafe for Limitor<T, C> where
    C: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.