pub trait Downcast: ErasedType {
// Provided methods
fn is<T: DowncastType>(&self) -> bool { ... }
fn downcast_ref<T: DowncastType>(&self) -> Option<&T> { ... }
fn downcast_mut<T: DowncastType>(&mut self) -> Option<&mut T> { ... }
}Expand description
Extension methods for deterministic concrete-type downcasting.
Provided Methods§
Sourcefn is<T: DowncastType>(&self) -> bool
fn is<T: DowncastType>(&self) -> bool
Returns whether the erased value has concrete type T.
Sourcefn downcast_ref<T: DowncastType>(&self) -> Option<&T>
fn downcast_ref<T: DowncastType>(&self) -> Option<&T>
Returns the erased value as T when its key matches.
Sourcefn downcast_mut<T: DowncastType>(&mut self) -> Option<&mut T>
fn downcast_mut<T: DowncastType>(&mut self) -> Option<&mut T>
Returns the erased value as mutable T when its key matches.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".