Expand description
A trait to represent zero-cost conversions.
Traits§
- A marker trait such that the existence of
From: Coerce<To>
implies thatFrom
can be treat asTo
without any data manipulation. Particularly useful for containers, e.g.Vec<From>
can be treated asVec<To>
in O(1). If such an instance is available, you can usecoerce
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)
.