Expand description
A trait to represent zero-cost conversions.
Traits
A marker trait such that the existence of
From: Coerce<To>
implies
that From
can be treat as To
without any data manipulation.
Particularly useful for containers, e.g. Vec<From>
can be treated as
Vec<To>
in O(1). If such an instance is available,
you can use coerce
to perform the conversion.Functions
Safely convert between types which have a
Coerce
relationship.
Often the second type argument will need to be given explicitly,
e.g. coerce::<_, ToType>(x)
.