This version is a substantial revision of easy-cast, introducing generics over rounding modes via the new Rounding trait.
Simple usage via the Conv, Cast, ConvApprox and CastApprox traits is largely unchanged. Usage with other rounding modes should be moved to the new ConvTo and CastTo traits (e.g. i32::conv_to(Nearest, 5.3), x.cast_to(Floor)).
External implementations of conversions should be moved to the ConvExact and ConvTo traits.
Added:
Roundingtrait withExact,Approxrounding modes (#58)Trunc,Nearest,Floor,Ceilrounding modes (#61)ConvExacttrait as an implementation helper for conversions which are never inexact (#58, #65)ConvTotrait for implementation and usage of conversions with a specific rounding mode (#58, #60, #63, #65)CastTotrait for casting with a specific rounding mode (#58, #60, #63)RangeErroras a new error type (#56)
Changed:
- Added an associated
Errortype to theConvandCasttraits (#62) - Rename
impl_via_trivial!toimpl_via_identity!(#68) - Implement
Exactf64 → f32conversion (#59) - Implement
ApproxandNearestint-to-float conversions (#59, #63) u128::MAXand other too-large values no longer coerce tof32::INFINITYunderExactrounding, as used byConvandCast(#67)- Truncating-conversions (
Trunc) no longer require thestdorlibmfeature (#66) - Implement
core::error::Erroron no-std (#57) - Enabled the
doc_cfgfeature (#66)
Removed:
Resulttype-def (#56)ConvFloat,CastFloattraits; this functionality remains available through the new rounding modes (#61)
Full Changelog: 0.6.1...0.7.0