pub trait Downcast<T>: Anywhere
T: Any,{
// Provided methods
fn is_type(&self) -> bool { ... }
unsafe fn downcast_ref_unchecked(&self) -> &T { ... }
fn downcast_ref(&self) -> Result<&T, TypeMismatch> { ... }
unsafe fn downcast_mut_unchecked(&mut self) -> &mut T { ... }
fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch> { ... }
unsafe fn downcast_unchecked(self: Box<Self>) -> Box<T> { ... }
fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<Self>>> { ... }
}
Provided Methods§
fn is_type(&self) -> bool
unsafe fn downcast_ref_unchecked(&self) -> &T
fn downcast_ref(&self) -> Result<&T, TypeMismatch>
unsafe fn downcast_mut_unchecked(&mut self) -> &mut T
fn downcast_mut(&mut self) -> Result<&mut T, TypeMismatch>
unsafe fn downcast_unchecked(self: Box<Self>) -> Box<T>
fn downcast(self: Box<Self>) -> Result<Box<T>, DowncastError<Box<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.