Castable

Trait Castable 

Source
pub trait Castable: NativeObject {
    // Provided methods
    fn is<T>(&self) -> bool
       where T: NativeObject { ... }
    fn upcast<T: Castable>(&self) -> &T
       where Self: DerivedFrom<T> { ... }
    fn downcast<T>(&self) -> Option<&T>
       where T: DerivedFrom<Self> + NativeObject { ... }
}

Provided Methods§

Source

fn is<T>(&self) -> bool
where T: NativeObject,

Source

fn upcast<T: Castable>(&self) -> &T
where Self: DerivedFrom<T>,

Source

fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self> + NativeObject,

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.

Implementors§