pub struct BlockWiseReader<'a> { /* private fields */ }

Implementations§

source§

impl<'a> BlockWiseReader<'a>

source

pub fn new(r: Box<dyn Read + 'a>) -> Self

source

pub fn available_bytes(&self) -> usize

bytes from the current pos position to the end of the internal vector

source

pub fn size(&self) -> usize

overall size of the internal vector, is the same as available_bytes() + pos_get()

source

pub fn slurp(&mut self, bytecount: usize) -> Result<usize, Error>

Reads bytecount bytes from the stream and returns the amount of available bytes starting at pos, which can be more than bytecount when subsequently already read more, but also less if there were not enough available.

source

pub fn slurp_loop(&mut self, buffersize: usize) -> Result<usize, Error>

Reads bytes from the stream in buffersize steps as long as there are bytes available.

source

pub fn find(&self, e: u8) -> Option<usize>

source

pub fn search(&self, bytes: &[u8]) -> Option<usize>

source

pub fn pos_set(&mut self, pos: usize)

source

pub fn pos_add(&mut self, pos: usize)

source

pub fn pos_sub(&mut self, pos: usize)

source

pub fn pos_add_i(&mut self, pos: isize)

source

pub fn pos_cut(&mut self) -> Vec<u8>

removes all elements form the beginning of the internal vector to pos and returns the removed elements

source

pub fn pos_inject(&mut self, s: &[u8])

copies the data of the slice s at the position pos

source

pub fn get(&self) -> &[u8]

returns all data from pos to the end of the internal vector

source

pub fn get_back(&self, back: usize) -> &[u8]

returns all data from pos - back to pos of the internal vector

source

pub fn get_from(&self, pos: usize) -> &[u8]

returns all data from the given pos to the end of the internal vector

source

pub fn get_from_to_current(&self, pos: usize) -> &[u8]

returns all data from the given pos to the internal pos

source

pub fn slurp_match_repos(&mut self, marker_str: &[u8]) -> Result<bool, Error>

slurps as much as the marker_str is long and returns true if the content is the same as the marker_str, repositions the current position to the end of the marker

source

pub fn match_back(&self, marker_str: &[u8]) -> bool

matches a fixed string from pos - marker_str.len() to pos, returns true if matched

source

pub fn slurp_find_repos1( &mut self, bytecount: usize, e: u8 ) -> Result<bool, Error>

sets pos to find position position + 1 if found

source

pub fn slurp_find_repos0( &mut self, bytecount: usize, e: u8 ) -> Result<bool, Error>

sets pos to find position if found

source

pub fn pos_get(&self) -> usize

the current pos value

source

pub fn slurp_search_repos0( &mut self, bytecount: usize, bytes: &[u8] ) -> Result<bool, Error>

sets pos to find position if found

source

pub fn slurp_search_repos1( &mut self, bytecount: usize, bytes: &[u8] ) -> Result<bool, Error>

sets pos after find position if found

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for BlockWiseReader<'a>

§

impl<'a> !Send for BlockWiseReader<'a>

§

impl<'a> !Sync for BlockWiseReader<'a>

§

impl<'a> Unpin for BlockWiseReader<'a>

§

impl<'a> !UnwindSafe for BlockWiseReader<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.