[][src]Trait cast_trait_object::DerivedDynCast

pub trait DerivedDynCast<T: DynCastConfig + Sealed, C: DynCastConfig> {
    fn derived_dyn_cast_ref(&self) -> Result<&T::Target, &T::Source>;
fn derived_dyn_cast_mut(&mut self) -> Result<&mut T::Target, &mut T::Source>;
fn derived_dyn_cast_boxed(
        self: Box<Self>
    ) -> Result<Box<T::Target>, Box<T::Source>>;
fn derived_dyn_cast_rc(
        self: Rc<Self>
    ) -> Result<Rc<T::Target>, Rc<T::Source>>;
fn derived_dyn_cast_arc(
        self: Arc<Self>
    ) -> Result<Arc<T::Target>, Arc<T::Source>>; }

This is an implementation detail for the macros that implement DynCast.

This trait is a copy of the DynCast trait with the difference that the config type (T) is constrained with a sealed trait so that it must be the ConcreteDynCastConfig type.

There is a blanket implementation so that any type that implements this trait also implements DynCast.

This trait is sometimes implemented by macros instead of the DynCast trait. This allows implementing DynCast for traits that have generic type parameters even if the type parameters aren't used by the type that DynCast is implemented for.

Required methods

fn derived_dyn_cast_ref(&self) -> Result<&T::Target, &T::Source>

Cast a shared reference of this trait object to another trait object.

fn derived_dyn_cast_mut(&mut self) -> Result<&mut T::Target, &mut T::Source>

Cast a mutable/unique reference of this trait object to another trait object.

fn derived_dyn_cast_boxed(
    self: Box<Self>
) -> Result<Box<T::Target>, Box<T::Source>>

This is supported on crate feature alloc only.

Cast a boxed trait object to another trait object.

fn derived_dyn_cast_rc(self: Rc<Self>) -> Result<Rc<T::Target>, Rc<T::Source>>

This is supported on crate feature alloc only.

Cast a reference counted trait object to another trait object.

fn derived_dyn_cast_arc(
    self: Arc<Self>
) -> Result<Arc<T::Target>, Arc<T::Source>>

This is supported on crate feature alloc only.

Cast an atomically reference counted trait object to another trait object.

Loading content...

Implementors

Loading content...