Trait concordium_std::SerialCtx
source · [−]pub trait SerialCtx {
fn serial_ctx<W: Write>(
&self,
size_length: SizeLength,
out: &mut W
) -> Result<(), W::Err>;
}Expand description
The SerialCtx trait provides a means of writing structures into byte-sinks
(Write) using contextual information.
The contextual information is:
size_length: The number of bytes used to record the length of the data.
Required Methods
fn serial_ctx<W: Write>(
&self,
size_length: SizeLength,
out: &mut W
) -> Result<(), W::Err>
fn serial_ctx<W: Write>(
&self,
size_length: SizeLength,
out: &mut W
) -> Result<(), W::Err>
Attempt to write the structure into the provided writer, failing if
if the length cannot be represented in the provided size_length or
only part of the structure could be written.
NB: We use Result instead of Option for better composability with other constructs.
Implementations on Foreign Types
sourceimpl<T: Serial> SerialCtx for &[T]
impl<T: Serial> SerialCtx for &[T]
fn serial_ctx<W: Write>(
&self,
size_len: SizeLength,
out: &mut W
) -> Result<(), W::Err>
sourceimpl SerialCtx for &str
impl SerialCtx for &str
fn serial_ctx<W: Write>(
&self,
size_len: SizeLength,
out: &mut W
) -> Result<(), W::Err>
Implementors
impl SerialCtx for String
impl<K: Serial + Ord> SerialCtx for BTreeSet<K>
impl<K: Serial + Ord, V: Serial> SerialCtx for BTreeMap<K, V>
impl<K: Serial> SerialCtx for HashSet<K>
Serialization for HashSet given a size_len. Values are not serialized in any particular order.
impl<K: Serial, V: Serial> SerialCtx for HashMap<K, V>
Serialization for HashMap given a size_len. Keys are not serialized in any particular order.