pub trait ManagedVecItem<M: ManagedTypeApi> {
    const PAYLOAD_SIZE: usize;
    const NEEDS_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§

source

const PAYLOAD_SIZE: usize

Size of the data stored in the underlying ManagedBuffer.

source

const NEEDS_RESERIALIZATION: bool

If false, 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). True for all managed types, but false for basic types (like u32).

Required Methods§

source

fn from_byte_reader<Reader: FnMut(&mut [u8])>(api: M, reader: Reader) -> Self

source

fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<M: ManagedTypeApi> ManagedVecItem<M> for i32

source§

const PAYLOAD_SIZE: usize = 4usize

source§

const NEEDS_RESERIALIZATION: bool = false

source§

fn from_byte_reader<Reader: FnMut(&mut [u8])>(_api: M, reader: Reader) -> Self

source§

fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R

source§

impl<M: ManagedTypeApi> ManagedVecItem<M> for u32

source§

const PAYLOAD_SIZE: usize = 4usize

source§

const NEEDS_RESERIALIZATION: bool = false

source§

fn from_byte_reader<Reader: FnMut(&mut [u8])>(_api: M, reader: Reader) -> Self

source§

fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R

source§

impl<M: ManagedTypeApi> ManagedVecItem<M> for usize

source§

const PAYLOAD_SIZE: usize = 4usize

source§

const NEEDS_RESERIALIZATION: bool = false

source§

fn from_byte_reader<Reader: FnMut(&mut [u8])>(_api: M, reader: Reader) -> Self

source§

fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R

Implementors§