Trait mononym::named::HasType [−][src]
pub trait HasType<T>: Name { }
Expand description
A marker trait that is used to mark a type-level name being bound to
a Rust value of the given type T
. This helps ensure that functions
that are generic over type-level names are “well-typed”, with
each name “having” their own type through HasType
.
With Name
being a supertrait of HasType
, this means that any
name type can have their “type” erased by downcasting the type from
impl HasType<T>
to impl Name
.
This trait is used as a type parameter inside Named
, so that the
type Named<impl HasType<T>, T>
also attaches the type information
to the type-level name associated with the named value.