Struct zstd::stream::raw::OutBuffer

source ·
pub struct OutBuffer<'a, C>where
    C: WriteBuf + ?Sized,
{ pub dst: &'a mut C, /* private fields */ }
Expand description

Wrapper around an output buffer.

C is usually either [u8] or Vec<u8>.

Bytes will be written starting at dst[pos].

pos will be updated after writing.

Invariant

pos <= dst.capacity()

Fields§

§dst: &'a mut C

Implementations§

source§

impl<'a, C> OutBuffer<'a, C>where
    C: WriteBuf + ?Sized,

source

pub fn around(dst: &'a mut C) -> OutBuffer<'a, C>

Returns a new OutBuffer around the given slice.

Starts with pos = 0.

source

pub fn around_pos(dst: &'a mut C, pos: usize) -> OutBuffer<'a, C>

Returns a new OutBuffer around the given slice, starting at the given position.

Panics

If pos >= dst.capacity().

source

pub fn pos(&self) -> usize

Returns the current cursor position.

source

pub unsafe fn set_pos(&mut self, pos: usize)

Sets the new cursor position.

Panics

If pos > self.dst.capacity().

Safety

Data up to pos must have actually been written to.

source

pub fn as_slice<'b>(&'b self) -> &'a [u8] where
    'b: 'a,

Returns the part of this buffer that was written to.

Trait Implementations§

source§

impl<'a, C> Debug for OutBuffer<'a, C>where
    C: Debug + WriteBuf + ?Sized,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, C: ?Sized> RefUnwindSafe for OutBuffer<'a, C>where
    C: RefUnwindSafe,

§

impl<'a, C: ?Sized> Send for OutBuffer<'a, C>where
    C: Send,

§

impl<'a, C: ?Sized> Sync for OutBuffer<'a, C>where
    C: Sync,

§

impl<'a, C: ?Sized> Unpin for OutBuffer<'a, C>

§

impl<'a, C> !UnwindSafe for OutBuffer<'a, C>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.