Trait jlrs::convert::into_julia::IntoJulia
source · pub unsafe trait IntoJulia: Sized + 'static {
// Required method
fn julia_type<'scope, T>(target: T) -> DataTypeData<'scope, T>
where T: Target<'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 cause undefined
behavior. The type in Rust must always be #[repr(C)]
. The DataType
must be an isbits-type.
Required Methods§
sourcefn julia_type<'scope, T>(target: T) -> DataTypeData<'scope, T>where
T: Target<'scope>,
fn julia_type<'scope, T>(target: T) -> DataTypeData<'scope, T>where T: Target<'scope>,
Returns the associated Julia type of the implementor.
The layout of that type and the Rust type must match exactly, and it must be an isbits
type, otherwise this trait has been implemented incorrectly.