Marshal

Trait Marshal 

Source
pub trait Marshal<'t>: Sized {
    type MunType;

    // Required methods
    fn marshal_from<'r>(value: Self::MunType, runtime: &'r Runtime) -> Self
       where Self: 't,
             'r: 't;
    fn marshal_into(self) -> Self::MunType;
    fn marshal_from_ptr<'r>(
        ptr: NonNull<Self::MunType>,
        runtime: &'r Runtime,
        type_info: &Type,
    ) -> Self
       where Self: 't,
             'r: 't;
    fn marshal_to_ptr(
        value: Self,
        ptr: NonNull<Self::MunType>,
        type_info: &Type,
    );
}
Expand description

Used to do value-to-value conversions that require runtime type information while consuming the input value.

If no TypeInfo is provided, the type is ().

Required Associated Types§

Source

type MunType

The type used in the Mun ABI

Required Methods§

Source

fn marshal_from<'r>(value: Self::MunType, runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Marshals from a value (i.e. Mun -> Rust).

Source

fn marshal_into(self) -> Self::MunType

Marshals itself into a Marshalled value (i.e. Rust -> Mun).

Source

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, runtime: &'r Runtime, type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Marshals the value at memory location ptr into a Marshalled value (i.e. Mun -> Rust).

Source

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, type_info: &Type)

Marshals value to memory location ptr (i.e. Rust -> Mun).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'t> Marshal<'t> for bool

Source§

type MunType = bool

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for f32

Source§

type MunType = f32

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for f64

Source§

type MunType = f64

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for i8

Source§

type MunType = i8

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for i16

Source§

type MunType = i16

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for i32

Source§

type MunType = i32

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for i64

Source§

type MunType = i64

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for i128

Source§

type MunType = i128

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for isize

Source§

type MunType = isize

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for u8

Source§

type MunType = u8

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for u16

Source§

type MunType = u16

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for u32

Source§

type MunType = u32

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for u64

Source§

type MunType = u64

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for u128

Source§

type MunType = u128

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for ()

Source§

type MunType = ()

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Source§

impl<'t> Marshal<'t> for usize

Source§

type MunType = usize

Source§

fn marshal_from<'r>(value: Self::MunType, _runtime: &'r Runtime) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_into<'r>(self) -> Self::MunType

Source§

fn marshal_from_ptr<'r>( ptr: NonNull<Self::MunType>, _runtime: &'r Runtime, _type_info: &Type, ) -> Self
where Self: 't, 'r: 't,

Source§

fn marshal_to_ptr(value: Self, ptr: NonNull<Self::MunType>, _type_info: &Type)

Implementors§

Source§

impl<'a, T: Marshal<'a> + 'a> Marshal<'a> for ArrayRef<'a, T>

Source§

type MunType = RawArray

Source§

impl<'s> Marshal<'s> for StructRef<'s>

Source§

type MunType = RawStruct