Macro libil2cpp::unsafe_impl_value_type
source · [−]unsafe_impl_value_type!() { /* proc-macro */ }
Expand description
Implements the Type
trait for a Rust type that is equivalent to a C# value
type
Note that in order to use this macros, the generic_associated_types
and
once_cell
features must be enabled.
This macro works the same way as unsafe_impl_reference_type!
, except
that it is meant for value types and implements some extra traits not
covered by blanket impls.
Safety
The type must hold the guarantees required by the Type
trait.
Examples
The basic syntax follows the pattern in <libil2cpp path> for <Rust type> => <C# type>
.
ⓘ
#![feature(generic_associated_types)]
#[repr(C)]
struct Vector3 {
x: f32,
y: f32,
z: f32,
}
unsafe_impl_value_type!(in libil2cpp for Vector3 => UnityEngine.Vector3);