Trait Downcast

Source
pub trait Downcast: Any {
    // Required methods
    fn as_any(&self) -> &(dyn Any + 'static);
    fn as_any_mut(&mut self) -> &mut (dyn Any + 'static);
    fn into_any(self: Box<Self>) -> Box<dyn Any>;
}
Expand description

A simple trait for downcasting through Any trait.

Required Methods§

Source

fn as_any(&self) -> &(dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.

Source

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.

Source

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

Implementors§

Source§

impl<T> Downcast for T
where T: Any,