pub trait UnsafeFromValue: Sized {
    type Output: 'static;
    type Guard: 'static;

    // Required methods
    fn unsafe_from_value(value: Value) -> VmResult<(Self::Output, Self::Guard)>;
    unsafe fn unsafe_coerce(output: Self::Output) -> Self;
}
👎Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.
Expand description

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.

Required Associated Types§

source

type Output: 'static

👎Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.

The output type from the unsafe coercion.

source

type Guard: 'static

👎Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.

The raw guard returned.

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

Required Methods§

source

fn unsafe_from_value(value: Value) -> VmResult<(Self::Output, Self::Guard)>

👎Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.

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.

source

unsafe fn unsafe_coerce(output: Self::Output) -> Self

👎Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.

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.

Object Safety§

This trait is not object safe.

Implementors§