pub unsafe trait Unbox {
type Output: Sized + Clone;
// Provided method
unsafe fn unbox(value: Value<'_, '_>) -> Self::Output { ... }
}
Expand description
A trait implemented by types that can be extracted from a Julia value with Value::unbox
.
This trait can be derived, it’s recommended
to use JlrsReflect.jl to ensure it’s implemented correctly. All layouts generated by
JlrsReflect.jl will implement this trait and ValidLayout
, which checks if the conversion
is valid at runtime.
If you do choose to implement it manually, you only need to provide the associated Output
type if the type matches the layout of the data in Julia. The default implementation of
unbox
dereferences the value as &Self::Output
and clones it. If this implementation is
incorrect it must be overridden.
Required Associated Types§
Provided Methods§
Object Safety§
This trait is not object safe.