Trait gluon_vm::gc::DataDef

source ·
pub unsafe trait DataDef {
    type Value: ?Sized + for<'a> FromPtr<&'a Self> + Trace;

    // Required methods
    fn size(&self) -> usize;
    fn initialize<'w>(
        self,
        ptr: WriteOnly<'w, Self::Value>
    ) -> &'w mut Self::Value;

    // Provided methods
    fn fields(&self) -> Option<&[InternedStr]> { ... }
    fn tag(&self) -> Option<&InternedStr> { ... }
}
Expand description

A definition of some data which may be allocated by the garbage collector.

Required Associated Types§

source

type Value: ?Sized + for<'a> FromPtr<&'a Self> + Trace

The type of the value allocated.

Required Methods§

source

fn size(&self) -> usize

Returns how many bytes need to be allocted for this DataDef

source

fn initialize<'w>(self, ptr: WriteOnly<'w, Self::Value>) -> &'w mut Self::Value

Consumes self to initialize the allocated value. Returns the initialized pointer.

Provided Methods§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DataDef for Vec<f64>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<u8>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<Value>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<GcPtr<Thread>>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<GcPtr<Box<dyn Userdata>>>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<GcPtr<ValueArray>>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<GcPtr<ValueStr>>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl DataDef for Vec<VmInt>

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a str

§

type Value = ValueStr

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueStr>) -> &'w mut ValueStr

source§

impl<'a> DataDef for &'a [f64]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [u8]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [Value]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [GcPtr<Thread>]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [GcPtr<Box<dyn Userdata>>]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [GcPtr<ValueArray>]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [GcPtr<ValueStr>]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

source§

impl<'a> DataDef for &'a [VmInt]

§

type Value = ValueArray

source§

fn size(&self) -> usize

source§

fn initialize<'w>(self, result: WriteOnly<'w, ValueArray>) -> &'w mut ValueArray

Implementors§

source§

impl<'a, T> DataDef for Borrow<'a, T>
where T: DataDef, T::Value: Sized,

§

type Value = <T as DataDef>::Value

source§

impl<T> DataDef for Move<T>
where T: Trace,

§

type Value = T