pub trait Downcast: AsAny {
// Provided methods
fn is<T>(&self) -> bool
where T: AsAny { ... }
fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny { ... }
fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny { ... }
}
Expand description
This is a shim around AaAny
to avoid some boilerplate code.
It is a separate trait because it is also implemented
on runtime polymorphic traits (which are !Sized
).
Provided Methods§
sourcefn is<T>(&self) -> boolwhere
T: AsAny,
fn is<T>(&self) -> boolwhere T: AsAny,
Returns true
if the boxed type is the same as T
.
Forward to the method defined on the type Any
.
sourcefn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where T: AsAny,
Forward to the method defined on the type Any
.
sourcefn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where T: AsAny,
Forward to the method defined on the type Any
.