artichoke_backend::convert

Trait BoxUnboxVmValue

Source
pub trait BoxUnboxVmValue {
    type Unboxed;
    type Guarded;

    const RUBY_TYPE: &'static str;

    // Required methods
    unsafe fn unbox_from_value<'a>(
        value: &'a mut Value,
        interp: &mut Artichoke,
    ) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>;
    fn alloc_value(
        value: Self::Unboxed,
        interp: &mut Artichoke,
    ) -> Result<Value, Error>;
    fn box_into_value(
        value: Self::Unboxed,
        into: Value,
        interp: &mut Artichoke,
    ) -> Result<Value, Error>;
    fn free(data: *mut c_void);
}

Required Associated Constants§

Source

const RUBY_TYPE: &'static str

Required Associated Types§

Required Methods§

Source

unsafe fn unbox_from_value<'a>( value: &'a mut Value, interp: &mut Artichoke, ) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>

§Safety

Implementations may return owned values. These values must not outlive the underlying mrb_value, which may be garbage collected by mruby.

The values returned by this method should not be stored for more than the current FFI trampoline entry point.

Source

fn alloc_value( value: Self::Unboxed, interp: &mut Artichoke, ) -> Result<Value, Error>

Source

fn box_into_value( value: Self::Unboxed, into: Value, interp: &mut Artichoke, ) -> Result<Value, Error>

Source

fn free(data: *mut c_void)

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 BoxUnboxVmValue for String

Source§

const RUBY_TYPE: &'static str = "String"

Source§

type Unboxed = String

Source§

type Guarded = String

Source§

unsafe fn unbox_from_value<'a>( value: &'a mut Value, interp: &mut Artichoke, ) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>

Source§

fn alloc_value( value: Self::Unboxed, interp: &mut Artichoke, ) -> Result<Value, Error>

Source§

fn box_into_value( value: Self::Unboxed, into: Value, interp: &mut Artichoke, ) -> Result<Value, Error>

Source§

fn free(data: *mut c_void)

Source§

impl BoxUnboxVmValue for Symbol

Source§

const RUBY_TYPE: &'static str = "Symbol"

Source§

type Unboxed = Symbol

Source§

type Guarded = Immediate<<Symbol as BoxUnboxVmValue>::Unboxed>

Source§

unsafe fn unbox_from_value<'a>( value: &'a mut Value, interp: &mut Artichoke, ) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>

Source§

fn alloc_value( value: Self::Unboxed, interp: &mut Artichoke, ) -> Result<Value, Error>

Source§

fn box_into_value( value: Self::Unboxed, into: Value, interp: &mut Artichoke, ) -> Result<Value, Error>

Source§

fn free(data: *mut c_void)

Implementors§

Source§

impl<T> BoxUnboxVmValue for T
where T: HeapAllocatedData + Sized + 'static,

Source§

const RUBY_TYPE: &'static str = <Self as HeapAllocatedData>::RUBY_TYPE

Source§

type Unboxed = T

Source§

type Guarded = HeapAllocated<<T as BoxUnboxVmValue>::Unboxed>