Skip to main content

ObjectCore

Trait ObjectCore 

Source
pub unsafe trait ObjectCore: Sized + 'static {
    const TYPE_KEY: &'static str;
    const TYPE_DEPTH: i32;

    // Required methods
    fn type_index() -> i32;
    unsafe fn object_header_mut(this: &mut Self) -> &mut TVMFFIObject;
}
Expand description

Traits that can be used to check if a type is an object

This trait is unsafe because it is used to access the object header and the object header is unsafe to access

Required Associated Constants§

Source

const TYPE_KEY: &'static str

the type key of the object

Source

const TYPE_DEPTH: i32

Depth of this type in the object inheritance tree.

The root Object has depth zero, and every registered subtype has depth one greater than its parent. This value must be non-negative and agree with the runtime type table entry for Self.

Required Methods§

Source

fn type_index() -> i32

Source

unsafe fn object_header_mut(this: &mut Self) -> &mut TVMFFIObject

Return the object header This function is implemented as a static function so

§Arguments
  • this - The object to get the header
§Returns
  • &mut TVMFFIObject - The object header \return The object header

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§

Source§

impl ObjectCore for ArrayObj

Source§

const TYPE_KEY: &'static str = "ffi.Array"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for MapObj

Source§

const TYPE_KEY: &'static str = "ffi.Map"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for ShapeObj

Source§

const TYPE_KEY: &'static str = "ffi.Shape"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for TensorObj

Source§

const TYPE_KEY: &'static str = "ffi.Tensor"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for ErrorObj

Source§

const TYPE_KEY: &'static str = "ffi.Error"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for ModuleObj

Source§

const TYPE_KEY: &'static str = "ffi.Module"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for FunctionObj

Source§

const TYPE_KEY: &'static str = "ffi.Function"

Source§

const TYPE_DEPTH: i32

Source§

impl ObjectCore for Object

Source§

const TYPE_KEY: &'static str = "ffi.Object"

Source§

const TYPE_DEPTH: i32 = 0