pub struct SerializationSink { /* private fields */ }

Implementations§

source§

impl SerializationSink

source

pub fn into_bytes(self) -> Vec<u8>

Creates a copy of all data written so far. This method is meant to be used for writing unit tests. It will panic if the underlying BackingStorage is a file.

source

pub fn write_atomic<W>(&self, num_bytes: usize, write: W) -> Addr
where W: FnOnce(&mut [u8]),

Atomically writes num_bytes of data to this SerializationSink. Atomic means the data is guaranteed to be written as a contiguous range of bytes.

The buffer provided to the write callback is guaranteed to be of size num_bytes and write is supposed to completely fill it with the data to be written.

The return value is the address of the data written and can be used to refer to the data later on.

source

pub fn write_bytes_atomic(&self, bytes: &[u8]) -> Addr

Atomically writes the data in bytes to this SerializationSink. Atomic means the data is guaranteed to be written as a contiguous range of bytes.

This method may perform better than write_atomic because it may be able to skip the sink’s internal buffer. Use this method if the data to be written is already available as a &[u8].

The return value is the address of the data written and can be used to refer to the data later on.

source

pub fn as_std_write<'a>(&'a self) -> impl Write + 'a

Trait Implementations§

source§

impl Debug for SerializationSink

source§

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

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

impl Drop for SerializationSink

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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>,

§

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>,

§

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.