Skip to main content

CastTo

Trait CastTo 

Source
pub trait CastTo<Iface: ?Sized> {
    // Required method
    fn cast(self: Arc<Self>) -> Arc<Iface> ;
}
Expand description

Asserts that Self can be coerced into Arc<Iface>.

Implemented automatically by the #[interface(dyn Iface)] attribute on #[component] structs. The implementation simply performs the unsizing coercion at the concrete call site where the compiler can verify it, letting CatalogBuilder::bind work on stable Rust without #![feature(unsize)].

Required Methods§

Source

fn cast(self: Arc<Self>) -> Arc<Iface>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§