Trait jlrs::convert::unbox::Unbox [−][src]
pub unsafe trait Unbox {
type Output: Sized + Clone;
unsafe fn unbox(value: Value<'_, '_>) -> Self::Output { ... }
}
Expand description
Trait implemented by types that can be extracted from a Julia value in combination with
Value::unbox
and Value::unbox_unchecked
. This trait can be derived, it’s recommended
to use JlrsReflect.jl to ensure it’s implemented correctly. All wrappers 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 can be overridden.