pub trait Any: StdAny {
// Required method
fn type_name(&self) -> &'static str;
}Required Methods§
Implementations§
Source§impl dyn Any
impl dyn Any
pub fn is<_T>(&self) -> bool
pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
Source§impl dyn Any + Send
impl dyn Any + Send
pub fn is<_T>(&self) -> bool
pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
Source§impl dyn Any + Sync
impl dyn Any + Sync
pub fn is<_T>(&self) -> bool
pub fn downcast_ref<_T>(&self) -> Result<&_T, TypeMismatch>
pub fn downcast_mut<_T>(&mut self) -> Result<&mut _T, TypeMismatch>
pub fn downcast<_T>( self: Box<Self>, ) -> Result<Box<_T>, DowncastError<Box<Self>>>
pub fn downcast_rc<_T>( self: Rc<Self>, ) -> Result<Rc<_T>, DowncastError<Rc<Self>>>
Trait Implementations§
Source§impl<_T> Downcast<_T> for dyn Anywhere
_T: Any,
impl<_T> Downcast<_T> for dyn Anywhere
_T: Any,
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>>>
Source§impl<_T> Downcast<_T> for dyn Any + Sendwhere
_T: Any,
impl<_T> Downcast<_T> for dyn Any + Sendwhere
_T: Any,
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>>>
Source§impl<_T> Downcast<_T> for dyn Any + Syncwhere
_T: Any,
impl<_T> Downcast<_T> for dyn Any + Syncwhere
_T: Any,
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>>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".