Skip to main content

ExtensionsWriter

Struct ExtensionsWriter 

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

Write sorted extension IDs into caller-owned scratch storage.

Implementations§

Source§

impl<'a> ExtensionsWriter<'a>

Source

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

Start an empty block in a slice distinct from the final frame output.

Source

pub fn push<T: Serialize + ?Sized>( &mut self, context: &WriteContext<'_>, id: u32, value: &T, ) -> Result<(), Error>

Append a field with a greater, nonzero ID and a typed Postcard payload.

§Errors

Returns an ordering, serialization, allowance or scratch capacity error. A failed append may change bytes beyond the last successfully written field.

Source

pub fn finish(self) -> Extensions<'a>

Borrow the completed extension bytes from the caller’s scratch storage.

Source

pub fn finish_and_tail(self) -> (Extensions<'a>, &'a mut [u8])

Borrow the completed block and return the remaining scratch space.

The returned slice can stage the next field or record while the completed block remains borrowed.

Auto Trait Implementations§

§

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

§

impl<'a> Forget for ExtensionsWriter<'a>

§

impl<'a> Freeze for ExtensionsWriter<'a>
where &'a mut [u8]: Freeze,

§

impl<'a> Move for ExtensionsWriter<'a>

§

impl<'a> RefUnwindSafe for ExtensionsWriter<'a>

§

impl<'a> Send for ExtensionsWriter<'a>

§

impl<'a> Sync for ExtensionsWriter<'a>

§

impl<'a> Unpin for ExtensionsWriter<'a>
where &'a mut [u8]: Unpin,

§

impl<'a> UnsafeUnpin for ExtensionsWriter<'a>
where &'a mut [u8]: UnsafeUnpin,

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.