Trait runestick::UnsafeFromValue[][src]

pub trait UnsafeFromValue: Sized {
    type Output: 'static;
    type Guard: 'static;
    fn from_value(value: Value) -> Result<(Self::Output, Self::Guard), VmError>;
unsafe fn unsafe_coerce(output: Self::Output) -> Self; }

A potentially unsafe conversion for value conversion.

This trait is used to convert values to references, which can be safely used while an external function call is used. That sort of use is safe because we hold onto the guard returned by the conversion during external function calls.

Associated Types

type Output: 'static[src]

The output type from the unsafe coercion.

type Guard: 'static[src]

The raw guard returned.

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

Loading content...

Required methods

fn from_value(value: Value) -> Result<(Self::Output, Self::Guard), VmError>[src]

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.

unsafe fn unsafe_coerce(output: Self::Output) -> Self[src]

Coerce the output of an unsafe from value into the final output type.

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.

Loading content...

Implementations on Foreign Types

impl UnsafeFromValue for &Error[src]

type Output = *const Error

type Guard = RawRef

impl UnsafeFromValue for &mut Error[src]

type Output = *mut Error

type Guard = RawMut

impl UnsafeFromValue for &Error[src]

type Output = *const Error

type Guard = RawRef

impl UnsafeFromValue for &mut Error[src]

type Output = *mut Error

type Guard = RawMut

impl UnsafeFromValue for &Error[src]

type Output = *const Error

type Guard = RawRef

impl UnsafeFromValue for &mut Error[src]

type Output = *mut Error

type Guard = RawMut

impl UnsafeFromValue for &Ordering[src]

type Output = *const Ordering

type Guard = RawRef

impl UnsafeFromValue for &mut Ordering[src]

type Output = *mut Ordering

type Guard = RawMut

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

type Output = *const [u8]

type Guard = RawRef

impl UnsafeFromValue for &Option<Value>[src]

type Output = *const Option<Value>

type Guard = RawRef

impl UnsafeFromValue for &mut Option<Value>[src]

type Output = *mut Option<Value>

type Guard = RawMut

impl UnsafeFromValue for &mut Result<Value, Value>[src]

type Output = *mut Result<Value, Value>

type Guard = RawMut

impl UnsafeFromValue for &str[src]

type Output = *const str

type Guard = StrGuard

impl UnsafeFromValue for &mut str[src]

type Output = *mut str

type Guard = Option<RawMut>

impl UnsafeFromValue for &String[src]

type Output = *const String

type Guard = StrGuard

impl UnsafeFromValue for &mut String[src]

type Output = *mut String

type Guard = RawMut

impl UnsafeFromValue for &Result<Value, Value>[src]

type Output = *const Result<Value, Value>

type Guard = RawRef

impl UnsafeFromValue for &ParseCharError[src]

type Output = *const ParseCharError

type Guard = RawRef

impl UnsafeFromValue for &mut ParseCharError[src]

type Output = *mut ParseCharError

type Guard = RawMut

impl UnsafeFromValue for &ParseFloatError[src]

type Output = *const ParseFloatError

type Guard = RawRef

impl UnsafeFromValue for &mut ParseFloatError[src]

type Output = *mut ParseFloatError

type Guard = RawMut

impl UnsafeFromValue for &ParseIntError[src]

type Output = *const ParseIntError

type Guard = RawRef

impl UnsafeFromValue for &mut ParseIntError[src]

type Output = *mut ParseIntError

type Guard = RawMut

impl<'a> UnsafeFromValue for &'a [Value][src]

type Output = *const [Value]

type Guard = RawRef

Loading content...

Implementors

impl UnsafeFromValue for &GeneratorState[src]

type Output = *const GeneratorState

type Guard = RawRef

impl UnsafeFromValue for &Future[src]

type Output = *const Future

type Guard = RawRef

impl UnsafeFromValue for &Generator[src]

type Output = *const Generator

type Guard = RawRef

impl UnsafeFromValue for &Object[src]

type Output = *const Object

type Guard = RawRef

impl UnsafeFromValue for &Range[src]

type Output = *const Range

type Guard = RawRef

impl UnsafeFromValue for &Stream[src]

type Output = *const Stream

type Guard = RawRef

impl UnsafeFromValue for &Function[src]

type Output = *const Function

type Guard = RawRef

impl UnsafeFromValue for &mut GeneratorState[src]

type Output = *mut GeneratorState

type Guard = RawMut

impl UnsafeFromValue for &mut Future[src]

type Output = *mut Future

type Guard = RawMut

impl UnsafeFromValue for &mut Generator[src]

type Output = *mut Generator

type Guard = RawMut

impl UnsafeFromValue for &mut Object[src]

type Output = *mut Object

type Guard = RawMut

impl UnsafeFromValue for &mut Range[src]

type Output = *mut Range

type Guard = RawMut

impl UnsafeFromValue for &mut Stream[src]

type Output = *mut Stream

type Guard = RawMut

impl<'a> UnsafeFromValue for &'a Bytes[src]

type Output = *const Bytes

type Guard = RawRef

impl<'a> UnsafeFromValue for &'a Iterator[src]

type Output = *const Iterator

type Guard = RawRef

impl<'a> UnsafeFromValue for &'a Vec[src]

type Output = *const Vec

type Guard = RawRef

impl<'a> UnsafeFromValue for &'a mut Bytes[src]

type Output = *mut Bytes

type Guard = RawMut

impl<'a> UnsafeFromValue for &'a mut Iterator[src]

type Output = *mut Iterator

type Guard = RawMut

impl<'a> UnsafeFromValue for &'a mut Vec[src]

type Output = *mut Vec

type Guard = RawMut

impl<T> UnsafeFromValue for T where
    T: FromValue
[src]

type Output = T

type Guard = ()

Loading content...