Trait Inheritable
pub unsafe trait Inheritable: Sized {
// Provided methods
unsafe fn downcast_unchecked<T>(self) -> T
where T: Inherits<Self> { ... }
unsafe fn downcast_unchecked_ref<T>(&self) -> &T
where T: Inherits<Self> { ... }
}Expand description
Represents Kanzi classes that can be inherited from.
This implies that such classes can be downcast to a more specific type.
§Safety
Inhertiable is an internal trait and shouldn’t be implemented by users directly.
Provided Methods§
unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked<T>(self) -> Twhere
T: Inherits<Self>,
Downcast the object to a more specific type.
§Safety
This is a wrapper over std::mem::transmute_copy with a bit more specific types.
All of the safety requirements for transmute_copy apply here as well.
unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
unsafe fn downcast_unchecked_ref<T>(&self) -> &Twhere
T: Inherits<Self>,
Downcast the object reference to a more specific type.
§Safety
This is a wrapper over std::mem::transmute with a bit more specific types.
All of the safety requirements for transmute apply here as well.
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.