Crate traitcast_core

Source
Expand description

This module is a general interface to traitcast which does not rely on a global registry. This makes it more flexible at the cost of having to create a registry and pass it around. If you do not want to do that, use the root traitcast module which provides a convenient global registry.

Macros§

defn_impl_entry_wrapper
Creates a struct named $wrapper which wraps ImplEntry<dyn $trait> for the given $trait. This is useful because it allows implementing traits on the ImplEntry<dyn $trait> from external modules. This is an implementation detail of traitcast_to_trait!.
impl_entry
Constructs a ImplEntry for a trait and a concrete struct implementing that trait.

Structs§

CastIntoTrait
Provides methods for casting into the target trait object from other trait objects.
ImplEntry
An entry in the table for a particular castable trait. Stores methods to cast into one particular struct that implements the trait.
Registry
A registry defining how to cast into some set of traits.

Traits§

TraitcastFrom
Subtraits of TraitcastFrom may be cast into dyn Any, and thus may be cast into any other castable dynamic trait object, too. This is blanket implemented for all sized types with static lifetimes.