Trait UnsafeFromValue

Source
pub trait UnsafeFromValue: Sized {
    type Guard;

    // Required method
    unsafe fn unsafe_from_value(
        value: ValuePtr,
        vm: &mut Vm,
    ) -> Result<(Self, Self::Guard), StackError>;
}
Expand description

A potentially unsafe conversion for value conversion.

Required Associated Types§

Source

type Guard

The raw guard returned.

Must only be dropped after the value returned from this function is no longer live.

Required Methods§

Source

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(Self, Self::Guard), StackError>

Convert the given reference using unsafe assumptions to a value.

§Safety

The return value of this function may only be used while a virtual machine is not being modified.

You must also make sure that the returned value does not outlive the guard.

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<'a> UnsafeFromValue for &'a str

Source§

type Guard = RawRefGuard

Source§

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(Self, Self::Guard), StackError>

Source§

impl<'a> UnsafeFromValue for &'a String

Source§

type Guard = RawRefGuard

Source§

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(Self, Self::Guard), StackError>

Source§

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

Source§

type Guard = RawRefGuard

Source§

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(Self, Self::Guard), StackError>

Source§

impl<'a> UnsafeFromValue for &'a mut String

Source§

type Guard = RawMutGuard

Source§

unsafe fn unsafe_from_value( value: ValuePtr, vm: &mut Vm, ) -> Result<(Self, Self::Guard), StackError>

Implementors§