pub struct ExtensionsWriter<'a> { /* private fields */ }Expand description
Write sorted extension IDs into caller-owned scratch storage.
Implementations§
Source§impl<'a> ExtensionsWriter<'a>
impl<'a> ExtensionsWriter<'a>
Sourcepub const fn new(output: &'a mut [u8]) -> Self
pub const fn new(output: &'a mut [u8]) -> Self
Start an empty block in a slice distinct from the final frame output.
Sourcepub fn push<T: Serialize + ?Sized>(
&mut self,
context: &WriteContext<'_>,
id: u32,
value: &T,
) -> Result<(), Error>
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.
Sourcepub fn finish(self) -> Extensions<'a>
pub fn finish(self) -> Extensions<'a>
Borrow the completed extension bytes from the caller’s scratch storage.
Sourcepub fn finish_and_tail(self) -> (Extensions<'a>, &'a mut [u8])
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>
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>
impl<'a> UnsafeUnpin for ExtensionsWriter<'a>where
&'a mut [u8]: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more