Trait jlrs::convert::into_julia::IntoJulia [−][src]
pub unsafe trait IntoJulia: Sized + 'static {
fn julia_type<'scope>(_: Global<'scope>) -> DataTypeRef<'scope>;
}
Expand description
Trait implemented by types that can be converted to a Julia value in combination with
Value::new
. This trait can be derived, it’s recommended to use JlrsReflect.jl to
ensure it’s implemented correctly.
If you do choose to implement it manually, you only need to implement the julia_type
method
which must return the DataType
of the type this data will have in Julia. The layout of this
type and the type in Rust must match exactly. Incompatible layouts will lead to UB. Note that
the type in Rust must always be #[repr(C)]
.
Required methods
fn julia_type<'scope>(_: Global<'scope>) -> DataTypeRef<'scope>
fn julia_type<'scope>(_: Global<'scope>) -> DataTypeRef<'scope>
Returns the associated Julia type of the implementor. The layout of that type and the Rust type must match exactly, otherwise the trait is implemented incorrectly.