Skip to main content

OutputSlice

Struct OutputSlice 

Source
pub struct OutputSlice<'a> {
    pub obuf: &'a mut [u8],
    pub pos: usize,
}
Expand description

A non-allocating append sink backed by a caller-provided slice.

Its logical view is the prefix written so far (given by pos).

Fields§

§obuf: &'a mut [u8]§pos: usize

Implementations§

Source§

impl<'a> OutputSlice<'a>

Source

pub fn new(obuf: &'a mut [u8]) -> Self

Creates an empty logical output over obuf without allocating.

Trait Implementations§

Source§

impl OutputBuf for OutputSlice<'_>

Source§

fn write_byte(&mut self, byte: u8)

Appends one byte to the logical output.
Source§

fn write_array<const N: usize>(&mut self, bytes: &[u8; N])

Appends a fixed-width group of bytes. Read more
Source§

fn write_bytes(&mut self, bytes: &[u8])

Appends all bytes in bytes to the logical output.
Source§

impl View for OutputSlice<'_>

Source§

type V = Seq<u8>

Auto Trait Implementations§

§

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

§

impl<'a> Freeze for OutputSlice<'a>

§

impl<'a> RefUnwindSafe for OutputSlice<'a>

§

impl<'a> Send for OutputSlice<'a>

§

impl<'a> Sync for OutputSlice<'a>

§

impl<'a> Unpin for OutputSlice<'a>

§

impl<'a> UnsafeUnpin for OutputSlice<'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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.