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.

Invariant

pos <= src.len()

Both fields are public, so this is checked (and panics if it does not hold) whenever the buffer is given to zstd.

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,

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

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

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

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

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

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