tvm_ffi::reflection

Trait UnsafeInit

Source
pub unsafe trait UnsafeInit: ObjectCore { }
Expand description

An object type whose object can start with every field undefined, for reflection to set the fields: C++ UnsafeInit.

The creator that #[rs_class] registers for its type makes the object with unsafe_init, which a JSON graph read back, __ffi_init__ and __ffi_new__ then fill. #[rs_class] implements it for its object, so the parent’s object must implement it too: Object does, and so does the object of a non-final C++ type bound by tvm-ffi-stubgen.

__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 (as [drop_if_defined] does), 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.

Implementors§