pub struct SerializationSink { /* private fields */ }Implementations§
Source§impl SerializationSink
impl SerializationSink
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
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.
Sourcepub fn write_atomic<W>(&self, num_bytes: usize, write: W) -> Addr
pub fn write_atomic<W>(&self, num_bytes: usize, write: W) -> Addr
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.
Sourcepub fn write_bytes_atomic(&self, bytes: &[u8]) -> Addr
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.