ToPrimitive implements conversions to all primitive numeric types, and provides to_T functions for each T, but AsPrimitive only implements a conversion to a single type, and there is currently no unifying trait that combines them all with as_T functions for each T. This change adds this trait, AsPrimInt, and automatically implements it on types that implement AsPrimitive<T> for all primitive integer types T.
ToPrimitive
implements conversions to all primitive numeric types, and providesto_T
functions for eachT
, butAsPrimitive
only implements a conversion to a single type, and there is currently no unifying trait that combines them all withas_T
functions for eachT
. This change adds this trait,AsPrimInt
, and automatically implements it on types that implementAsPrimitive<T>
for all primitive integer typesT
.