Trait Downcast

Source
pub trait Downcast: Sized {
    // Required method
    fn downcast<T>(&self) -> Option<T>
       where T: DowncastFrom<Self>;

    // Provided method
    fn is_a<T>(&self) -> bool
       where T: DowncastFrom<Self> { ... }
}
Expand description

This is the convenience trait whose method you should call to do a downcast.

Required Methods§

Source

fn downcast<T>(&self) -> Option<T>
where T: DowncastFrom<Self>,

Provided Methods§

Source

fn is_a<T>(&self) -> bool
where T: DowncastFrom<Self>,

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§

Source§

impl<U> Downcast for U