Struct bodyparser::LimitReader [] [src]

pub struct LimitReader<R> {
    // some fields omitted
}

Original impl

The LimitReader from the std just stops to read when reaches a limit, but we don't want to return partially readed body to the client code because it is useless. This modified LimitReader returns IoError with IoErrorKind::InvalidInput when it reaches the limit.

Methods

impl<R: Read> LimitReader<R>

fn new(r: R, limit: usize) -> LimitReader<R>

fn into_inner(self) -> R

fn limit(&self) -> usize

Trait Implementations

impl<R: Read> Read for LimitReader<R>

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

fn take(self, limit: u64) -> Take<Self>

fn tee<W>(self, out: W) -> Tee<Self, W> where W: Write

Derived Implementations

impl<R: Debug> Debug for LimitReader<R>

fn fmt(&self, __arg_0: &mut Formatter) -> Result