[][src]Trait runestick::UnsafeFromValue

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

A potentially unsafe conversion for value conversion.

This trait is specifically implemented for reference types to allow registered functions to take references to their inner value.

This is specifically safe, because a guard is always held to the reference.

Associated Types

type Output: 'static

The output type from the unsafe coercion.

type Guard: 'static

The raw guard returned.

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

Loading content...

Required methods

unsafe fn unsafe_from_value(
    value: Value
) -> Result<(Self::Output, Self::Guard), VmError>

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 to_arg(output: Self::Output) -> Self

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<'a> UnsafeFromValue for &'a ParseFloatError[src]

type Output = *const ParseFloatError

type Guard = RawOwnedRef

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

type Output = *mut ParseFloatError

type Guard = RawOwnedMut

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

type Output = *const ParseIntError

type Guard = RawOwnedRef

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

type Output = *mut ParseIntError

type Guard = RawOwnedMut

impl<'a> UnsafeFromValue for &'a Rev<Iter>[src]

type Output = *const Rev<Iter>

type Guard = RawOwnedRef

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

type Output = *mut Rev<Iter>

type Guard = RawOwnedMut

impl<'a> UnsafeFromValue for &'a Rev<Iter>[src]

type Output = *const Rev<Iter>

type Guard = RawOwnedRef

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

type Output = *mut Rev<Iter>

type Guard = RawOwnedMut

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

type Output = *const [u8]

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Option<Value>[src]

type Output = *const Option<Value>

type Guard = RawOwnedRef

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

type Output = *mut Option<Value>

type Guard = RawOwnedMut

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

type Output = *const Error

type Guard = RawOwnedRef

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

type Output = *mut Error

type Guard = RawOwnedMut

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

type Output = *const Error

type Guard = RawOwnedRef

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

type Output = *mut Error

type Guard = RawOwnedMut

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

type Output = *const Result<Value, Value>

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ str[src]

type Output = *const str

type Guard = Option<RawOwnedRef>

impl<'_> UnsafeFromValue for &'_ mut str[src]

type Output = *mut str

type Guard = Option<RawOwnedMut>

impl<'_> UnsafeFromValue for &'_ String[src]

type Output = *const String

type Guard = Option<RawOwnedRef>

impl<'_> UnsafeFromValue for &'_ mut String[src]

type Output = *mut String

type Guard = RawOwnedMut

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

type Output = *const [Value]

type Guard = RawOwnedRef

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

type Output = *const Vec<Value>

type Guard = RawOwnedRef

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

type Output = *mut Vec<Value>

type Guard = RawOwnedMut

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

type Output = *const Error

type Guard = RawOwnedRef

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

type Output = *mut Error

type Guard = RawOwnedMut

Loading content...

Implementors

impl<'_> UnsafeFromValue for &'_ GeneratorState[src]

type Output = *const GeneratorState

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Function[src]

type Output = *const Function

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Future[src]

type Output = *const Future

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Generator[src]

type Output = *const Generator

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Stream[src]

type Output = *const Stream

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ Object<Value>[src]

type Output = *const Object<Value>

type Guard = RawOwnedRef

impl<'_> UnsafeFromValue for &'_ mut GeneratorState[src]

type Output = *mut GeneratorState

type Guard = RawOwnedMut

impl<'_> UnsafeFromValue for &'_ mut Future[src]

type Output = *mut Future

type Guard = RawOwnedMut

impl<'_> UnsafeFromValue for &'_ mut Generator[src]

type Output = *mut Generator

type Guard = RawOwnedMut

impl<'_> UnsafeFromValue for &'_ mut Stream[src]

type Output = *mut Stream

type Guard = RawOwnedMut

impl<'_> UnsafeFromValue for &'_ mut Object<Value>[src]

type Output = *mut Object<Value>

type Guard = RawOwnedMut

impl<'a> UnsafeFromValue for &'a runestick::modules::object::Iter[src]

type Output = *const Iter

type Guard = RawOwnedRef

impl<'a> UnsafeFromValue for &'a runestick::modules::vec::Iter[src]

type Output = *const Iter

type Guard = RawOwnedRef

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

type Output = *const Bytes

type Guard = RawOwnedRef

impl<'a> UnsafeFromValue for &'a mut runestick::modules::object::Iter[src]

type Output = *mut Iter

type Guard = RawOwnedMut

impl<'a> UnsafeFromValue for &'a mut runestick::modules::vec::Iter[src]

type Output = *mut Iter

type Guard = RawOwnedMut

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

type Output = *mut Bytes

type Guard = RawOwnedMut

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

type Output = T

type Guard = ()

Loading content...