Macro def_object_ref
def_object_ref!() { /* proc-macro */ }Expand description
Define the reference to an object type, as C++
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE does:
def_object_ref!(TypeName, ParentType, ObjectName).
use tvm_ffi::def_object_ref;
def_object_ref!(
/// A pair of values.
pub Pair,
Base,
PairObj
);Pair holds a PairObj and is a derive(ObjectRef) type. It dereferences
to PairObj, and a PairObj converts into it.
ParentType is the reference to the parent’s object: Base here, and
tvm_ffi::object::ObjectRef for a type under ffi.Object. Pair converts
into it by impl_object_upcast!, so its object must be a registered base of
PairObj, as that macro requires. A conversion into the reference to a
further ancestor takes its own impl_object_upcast!.
Attributes and visibility before the name go on the struct. crate = path
after the object type is where the generated code finds tvm-ffi, as for
[rs_class].