Struct InBuffer

pub struct InBuffer<'a> { pub src: &'a [u8], pub pos: usize }

Wrapper around an input buffer.

Bytes will be read starting at src[pos].

pos will be updated after reading.

Fields

src: &'a [u8]
pos: usize

Implementations

impl<'a> InBuffer<'a>

fn around(src: &'a [u8]) -> Self

Returns a new InBuffer around the given slice.

Starts with pos = 0.

fn pos(&self) -> usize

Returns the current cursor position.

fn set_pos(&mut self, pos: usize)

Sets the new cursor position.

Panics

If pos > self.src.len().

Trait Implementations

impl<'a> Debug for InBuffer<'a>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<'a> Freeze for InBuffer<'a>

impl<'a> RefUnwindSafe for InBuffer<'a>

impl<'a> Send for InBuffer<'a>

impl<'a> Sync for InBuffer<'a>

impl<'a> Unpin for InBuffer<'a>

impl<'a> UnsafeUnpin for InBuffer<'a>

impl<'a> UnwindSafe for InBuffer<'a>

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for InBuffer<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for InBuffer<'a> where T: ?Sized,

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

impl<T> From<T> for InBuffer<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for InBuffer<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for InBuffer<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for InBuffer<'a> where U: TryFrom<T>,

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