downcast

Trait Downcast

Source
pub trait Downcast<T>: Any
where T: Any,
{ // Provided methods fn is_type(&self) -> bool { ... } fn downcast_ref(&self) -> Result<&T, TypeMismatch> { ... } fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch> { ... } fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<Self>>> { ... } fn downcast_rc(self: Rc<Self>) -> Result<Rc<T>, DowncastError<Rc<Self>>> { ... } }

Provided Methods§

Source

fn is_type(&self) -> bool

Source

fn downcast_ref(&self) -> Result<&T, TypeMismatch>

Source

fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch>

Source

fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<Self>>>

Source

fn downcast_rc(self: Rc<Self>) -> Result<Rc<T>, DowncastError<Rc<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<_T> Downcast<_T> for dyn Any + Send
where _T: Any,

Source§

impl<_T> Downcast<_T> for dyn Any + Sync
where _T: Any,

Source§

impl<_T> Downcast<_T> for dyn Any
where _T: Any,

Source§

impl<_T> Downcast<_T> for dyn AnySync
where _T: Any,