pub trait Downcast: Any {
    fn into_any(self: Box<Self>) -> Box<dyn Any>;
    fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>;
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
}
Expand description

Supports conversion to Any. Traits to be extended by impl_downcast! must extend Downcast.

Required Methods§

source

fn into_any(self: Box<Self>) -> Box<dyn Any>

Convert Box<Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.

source

fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<dyn Any>. Rc<dyn Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.

source

fn as_any(&self) -> &dyn Any

Convert &Trait (where Trait: Downcast) to &Anydyn Any. This is needed since Rust cannot generate &Anydyn Any’s vtable from &Trait’s.

source

fn as_any_mut(&mut self) -> &mut dyn Any

Convert &mut Trait (where Trait: Downcast) to &Anydyn Any. This is needed since Rust cannot generate &mut dyn Any’s vtable from &mut Trait’s.

Implementors§

source§

impl<T: Any> Downcast for T