pub trait DynCastConfig {
    type Target: ?Sized;
    type Source: ?Sized;
}
Expand description

Specifies the trait that we are casting from and the trait we are casting to.

The reason we need a “config” type instead of just specifying the source and target traits as type parameters in the DynCast trait is that the compiler would error out it certain situations due to it detecting “cycles”. “Hiding” the source and target traits as associated types prevent this from happening and allows using the DynCast trait as a supertrait of the source trait from which we perform a cast.

Required Associated Types

The trait we are casting to.

The trait we are casting from and that we want back if the cast failed.

Implementors