Struct il2_iltags::io::LimitedReader [−][src]
pub struct LimitedReader<'a> { /* fields omitted */ }
Expand description
The LimitedReader
implements a Reader
that wraps another
Reader
but defines a limited to the amount of bytes that can be
extracted from it.
This wrapper was designed to ease the implementation of the deserialization of the tags.
It is important to notice that LimitedReader
will test the
limits prior to the attempt to read the data, thus failed
attempts will not consume data from the inner reader.
Implementations
Creates a new instance of this struct.
Parameters:
src
: A mutable reference to the source Reader.available
: Number of bytes available for reading.
Verifies if it is possible to extract a given number of bytes from the source.
Parameters:
size
: The number of bytes to read.
Returns:
Ok(())
: On success.Err(ErrorKind)
: If the specified number of bytes is not available.
Returns the number of available bytes.
Returns:
- The number of available bytes.
Skips the required number of bytes required to achive the end of the specified limit.
Returns:
Ok(())
: On success.Err(ErrorKind)
: If the specified number of bytes is not available.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for LimitedReader<'a>
impl<'a> !Send for LimitedReader<'a>
impl<'a> !Sync for LimitedReader<'a>
impl<'a> Unpin for LimitedReader<'a>
impl<'a> !UnwindSafe for LimitedReader<'a>