Trait dharitri_wasm::types::ManagedVecItem
source · pub trait ManagedVecItem<M: ManagedTypeApi> {
const PAYLOAD_SIZE: usize;
const SKIPS_RESERIALIZATION: bool;
// Required methods
fn from_byte_reader<Reader: FnMut(&mut [u8])>(
api: M,
reader: Reader
) -> Self;
fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R;
}Expand description
Types that implement this trait can be items inside a ManagedVec.
All these types need a payload, i.e a representation that gets stored
in the underlying managed buffer.
Not all data needs to be stored as payload, for instance for most managed types
the payload is just the handle, whereas the mai ndata is kept by the VM.
Required Associated Constants§
sourceconst PAYLOAD_SIZE: usize
const PAYLOAD_SIZE: usize
Size of the data stored in the underlying ManagedBuffer.
sourceconst SKIPS_RESERIALIZATION: bool
const SKIPS_RESERIALIZATION: bool
If true, then the encoding of the item is identical to the payload,
and no further conversion is necessary
(the underlying buffer can be used as-is during serialization).
False for all managed types, but true for basic types (like u32).
Required Methods§
fn from_byte_reader<Reader: FnMut(&mut [u8])>(api: M, reader: Reader) -> Self
fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R
Object Safety§
This trait is not object safe.