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;
}
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ยง
Required Methodsยง
Sourcefn unsafe_from_value(value: Value) -> VmResult<(Self::Output, Self::Guard)>
๐Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.
fn unsafe_from_value(value: Value) -> VmResult<(Self::Output, Self::Guard)>
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.
Sourceunsafe fn unsafe_coerce(output: Self::Output) -> Self
๐Deprecated: Rune: Implementing this trait will no longer work. Use UnsafeToRef and UnsafeToMut instead.
unsafe fn unsafe_coerce(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.
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.