ObjectType
trait · ferroui-base · v0.5.0
trait ObjectType: StaticType + Upcast<crate::FerroObject> + Sized
Implemented by every class.
Safety
Implemented only by ferro_class! (and by hand for the root class).
Implementors guarantee that:
Selfis#[repr(C)]-compatible withParentat offset zero, i.e. a pointer toSelfis a valid pointer to every class in its ancestor chain;VTablelikewise starts withParent::VTableat offset zero;- values of
Selfare only created throughinstantiate(class structs have a privatebasefield andconstruct-style constructors that are only meaningful insideinstantiate).
Members
Parent
type Parent: ObjectType
The base class. The root class is its own parent.
IDENTITY
const IDENTITY: &'static TypeIdentity
The identity of the class (TypeIdentity): what is::<Self>(),
cast::<Self>() and downcast_ref::<Self>() compare. A type check names
this rather than StaticType::TYPE, so it does not keep the
initialisation, the constructor and the markup metadata of the class in
the executable (#612).
register_class
fn register_class()
The static initialisation of the class. The first call on a thread, after doing the same for the base class:
- makes the type known by name (
TypeInfo::find); - registers the handle type
Ref<Self>and the interface handles the class declares (ferro_class_info!) with the untyped value conversions; - registers the properties of the class in declaration order
(
ferro_properties!); - runs the static constructor of the class
(
ClassDefaults::static_constructor).
Later calls only read a thread-local flag.
Generated by ferro_class!. Called by instantiate, so a class
that has an instance on the thread is initialised, and through
TypeInfo::ensure_class_init by property accessors and the property
registry, for classes that have none.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.