Skip to main content

SliceOutputTarget

Struct SliceOutputTarget 

Source
pub struct SliceOutputTarget<'a> { /* private fields */ }
Expand description

A wrapper around a &mut [u8] that implements OutputTarget.

Trait Implementations§

Source§

impl<'a> Debug for SliceOutputTarget<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a mut [u8]> for SliceOutputTarget<'a>

Source§

fn from(value: &'a mut [u8]) -> Self

Creates a new SliceOutputTarget that wraps the provided buffer.

Source§

impl<'a, const N: usize> From<&'a mut [u8; N]> for SliceOutputTarget<'a>

Source§

fn from(value: &'a mut [u8; N]) -> Self

Creates a new SliceOutputTarget that wraps the provided array.

Source§

impl OutputTarget for SliceOutputTarget<'_>

Source§

fn remaining(&self) -> usize

Returns the number of unwritten bytes currently remaining in the target. Read more
Source§

fn write_byte(&mut self, byte: u8) -> Result<()>

Attempts to write the provided byte into this target.
Source§

fn write_bytes_exact(&mut self, bytes: &[u8]) -> Result<()>

Attempts to write the provided bytes into this target. Read more
Source§

fn write_bytes_into_reserved_exact( &mut self, reservation: &mut Reservation, bytes: &[u8], ) -> Result<()>

Attempts to write the provided bytes into a reserved chunk of memory within this target. Read more
Source§

fn reserve_space(&mut self, count: usize) -> Result<Reservation>

Reserves a chunk of memory in the target that can be written to later, and advances past it. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SliceOutputTarget<'a>

§

impl<'a> RefUnwindSafe for SliceOutputTarget<'a>

§

impl<'a> Send for SliceOutputTarget<'a>

§

impl<'a> Sync for SliceOutputTarget<'a>

§

impl<'a> Unpin for SliceOutputTarget<'a>

§

impl<'a> UnsafeUnpin for SliceOutputTarget<'a>

§

impl<'a> !UnwindSafe for SliceOutputTarget<'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 = 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>,

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.