pub trait ComponentDowncast<C: Component>: Injectable {
// Required method
fn downcast(
source: ComponentInstanceAnyPtr,
) -> Result<ComponentInstancePtr<Self>, ComponentInstanceAnyPtr>;
}
Expand description
Helper trait for traits implemented by components, thus allowing injection of components based
on dyn Trait
types. The type C
refers to a concrete component type. Typically automatically
derived when using the #[component_alias]
attribute.
Required Methods§
fn downcast( source: ComponentInstanceAnyPtr, ) -> Result<ComponentInstancePtr<Self>, ComponentInstanceAnyPtr>
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.