pub unsafe trait UnsafeInit: ObjectCore { }Expand description
An object type whose object can start with every field undefined, for reflection to set the fields.
The creator that #[rs_object] registers for its type makes the object with
unsafe_init, which a JSON graph read back, __ffi_init__ and
__ffi_new__ then fill. #[rs_object] implements it for its object, so the
parent’s object must implement it too: Object does, and so does a
binding with #[object(rs_parent)] on its derive(Object).
__ffi_init__ leaves an init_off field as the creator made it, so such a
field’s type must take all-zero bytes as a value, as a scalar, Option<T>
or Any does; the type’s registration fails otherwise.
§Safety
drop_defined_fields drops each defined field of the object and no
undefined one, the parent’s object’s included.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.