Skip to main content

DynCastConfig

Trait DynCastConfig 

Source
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§

Source

type Target: ?Sized

The trait we are casting to.

Source

type Source: ?Sized

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, T> DynCastConfig for ConcreteDynCastConfig<S, T>
where S: ?Sized, T: ?Sized,