Trait MetaInherits
pub trait MetaInherits<Base>: Inherits<Base> + ObjectConstraint { }Expand description
Inheritance relationship for Kanzi classes containing metaclass in their definitions.
Metaclasses are used for dynamically verifying inheritance between objects. Hence classes, implementing this trait, can be both upcasted to their base classes and downcasted to their parent classes.
Inherits trait, on contrary, implements only the upcasting.
let node: &Node = screen.upcast_ref();
let screen_2: Option<Screen> = node.clone().downcast()?;
let screen_2 = screen_2.expect("Screen downcasted back to its original type");
assert_eq!(screen, screen_2);
let node_3d: Option<&Node3D> = node.downcast_ref()?;
assert!(node_3d.is_none());Object Safety§
This trait is not object safe.