[−][src]Trait traitcast::Traitcast
A convenience trait with a blanket implementation that adds methods to cast from any trait that implements TraitcastFrom, to any trait that implements TraitcastTo.
Required methods
fn cast_ref(&self) -> Option<&To>
A convenience method that wraps the top-level cast_ref
function.
fn cast_mut(&mut self) -> Option<&mut To>
A convenience method that wraps the top-level cast_mut
function.
fn cast_box(self: Box<Self>) -> Result<Box<To>, Box<dyn Any>>
A convenience method that wraps the top-level cast_box
function.
Implementors
impl<From: ?Sized, To: ?Sized> Traitcast<To> for From where
From: TraitcastFrom,
To: TraitcastTo + 'static,
[src]
From: TraitcastFrom,
To: TraitcastTo + 'static,
fn cast_ref(&self) -> Option<&To>
[src]
Tries to cast self to a different dynamic trait object. This will
always return None if the implementation of the target trait, for the
concrete type of self, has not been registered via
traitcast_to_impl!
.
fn cast_mut(&mut self) -> Option<&mut To>
[src]
Tries to cast the self to a different dynamic trait object. This will
always return None if the implementation of the target trait, for the
concrete type of self, has not been registered via
traitcast_to_impl!
.
fn cast_box(self: Box<Self>) -> Result<Box<To>, Box<dyn Any>>
[src]
Tries to cast self to a boxed dynamic trait object. This will always
return Err if the implementation of the target trait, for the concrete
type of self, has not been registered via traitcast_to_impl!
.