Trait il2_iltags::io::array::MemoryReader [−][src]
pub trait MemoryReader: Reader {
fn len(&self) -> usize;
fn offset(&self) -> usize;
fn set_offset(&mut self, offset: usize);
fn is_empty(&self) -> bool { ... }
fn available(&self) -> usize { ... }
fn assert_can_read(&self, count: usize) -> Result<()> { ... }
}
Expand description
This trait provides an extension to Reader
for memory backed readers.
New since 1.4.0.
Required methods
fn set_offset(&mut self, offset: usize)
fn set_offset(&mut self, offset: usize)
Sets the current offset. If offset is larger than the length, it will set the offset to to the length of the data.
Provided methods
fn assert_can_read(&self, count: usize) -> Result<()>
fn assert_can_read(&self, count: usize) -> Result<()>
This method verifies if a certain amount of bytes can be read/extracted.
Arguments:
count
: Number of bytes to read;
Retunrs:
Ok(())
: If it is possible to read the specified amout of bytes;Err(ErrorKind::UnableToReadData)
: If there is not enough bytes to read;Err(ErrorKind::EndOfData)
: If there is no more data to read;