easy-cast
Type conversions which are expected to succeed
0.7.0
7.6M downloads/mo
#3622 most downloaded on crates.io
kas-gui/easy-cast
What this package is like to depend on
Last release 18 days ago
05 Aug 2026
Ships unpredictably
gaps range from 2 weeks to 2.0 years
Nearly every release is documented
notes for 16 of 17 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
17 releases · first in 2021
5 releases in the last 12 months
see the full history below
Release timeline
17 releases · Mar 2021 to Aug 2026Releases
latest 17-
0.7.005 Aug 2026Release notes
Open source →This version is a substantial revision of
easy-cast, introducing generics over rounding modes via the newRoundingtrait.Simple usage via the
Conv,Cast,ConvApproxandCastApproxtraits is largely unchanged. Usage with other rounding modes should be moved to the newConvToandCastTotraits (e.g.i32::conv_to(Nearest, 5.3),x.cast_to(Floor)).External implementations of conversions should be moved to the
ConvExactandConvTotraits.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
Release notes
Open source →This version is a substantial revision of
easy-cast, introducing generics over rounding modes via the newRoundingtrait.Simple usage via the
Conv,Cast,ConvApproxandCastApproxtraits is largely unchanged. Usage with other rounding modes should be moved to the newConvToandCastTotraits (e.g.i32::conv_to(Nearest, 5.3),x.cast_to(Floor)).External implementations of conversions should be moved to the
ConvExactandConvTotraits.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)
-
0.6.124 Jul 2026Release notes
Open source → -
0.6.021 Jul 2026Release notes
Open source →This release contains some breaking changes which should be easy/trivial to accommodate.
Fixed:
- Fix
unsafecode inNonZeroconversion on input values which wrap to zero (#52) - Fix: allow overflow of large
u128values tof32::INFINITY(#51)
Changed:
- Adjust
ConvApprox<f64> for f32to behave more like*_f64 as f32: too-large values round to infinity (instead of a range error) and rounding usesroundTiesToEven. Unlikeas f32, NAN still yieldsErr(Error::Range). (#47) - Change
Conv<f32> for f64to trap NAN (#48)
Removed:
Full Changelog: 0.5.5...0.6.0
Release notes
Open source →Fixed:
- Fix
unsafecode inNonZeroconversion on input values which wrap to zero (#52) - Fix: allow overflow of large
u128values tof32::INFINITY(#51)
Changed:
- Adjust
ConvApprox<f64> for f32to behave more like*_f64 as f32: too-large values round to infinity (instead of a range error) and rounding usesroundTiesToEven. Unlikeas f32, NAN still yieldsErr(Error::Range). (#47) - Change
Conv<f32> for f64to trap NAN (#48)
Removed:
- Remove support for
Saturating,Wrapping(#49) - Remove
assert_nonzerofeature flag (#52)
- Fix
-
0.5.508 Jul 2026Release notes
Open source →Support
core::rangetypes (MSRV = 1.96.0) by @dhardy in #44Full Changelog: 0.5.4...0.5.5
Release notes
Open source →- Bump MSRV to 1.96.0 and use Edition 2024 (#44)
- Support
std::rangetypes (#44)
-
0.5.420 Nov 2025Release notes
Open source →What's Changed
- Bump MSRV to 1.79.0
- Support
Conv,Castforcore::ops::Rangeand other range types (#38) - Support
Conv,Castforcore::num::{Saturating, Wrapping}(#38) - Support
Conv,Castforcore::num::NonZero(#39)
Full Changelog: 0.5.3...0.5.4
Release notes
Open source →- Bump MSRV to 1.79.0
- Support
Conv,Castforcore::ops::Rangeand other range types (#38) - Support
Conv,Castforcore::num::{Saturating, Wrapping}(#38) - Support
Conv,Castforcore::num::NonZero(#39)
-
0.5.312 Dec 2024Release notes
Open source → -
0.5.222 Dec 2022 -
0.5.114 Oct 2022 -
0.5.019 Aug 2022Release notes
Open source →- Reorganise code (#20)
- Bump MSRV to 1.53.0 (#21)
- Add default implementations of
convmethods over equivalenttry_conv
variant to facilitate custom implementations (#21) - Add
ConvApproxandCastApprox, supporting approximate conversions
with unspecified rounding, implemented forf64 → f32and all type
conversions supported byConv(#21) - Support
ConvandConvFloatfor arrays and tuples (#21) - Remove
impl<T> Conv<T> for T(#21) - Add
easy_cast::Resulttype alias (#22) - Move traits into new
easy_cast::traitspublic module (#23)
Release notes
Open source →- Reorganise code (#20)
- Bump MSRV to 1.53.0 (#21)
- Add default implementations of
convmethods over equivalenttry_convvariant to facilitate custom implementations (#21) - Add
ConvApproxandCastApprox, supporting approximate conversions with unspecified rounding, implemented forf64 → f32and all type conversions supported byConv(#21) - Support
ConvandConvFloatfor arrays and tuples (#21) - Remove
impl<T> Conv<T> for T(#21) - Add
easy_cast::Resulttype alias (#22) - Move traits into new
easy_cast::traitspublic module (#23)
-
0.4.412 Apr 2021 -
0.4.312 Apr 2021Release notes
Open source →- Unify some macros via
impl_int_generic(#16) - Improve error messages in asserts (#17)
- Unify some macros via
-
0.4.203 Apr 2021 -
0.4.101 Apr 2021 -
0.4.001 Apr 2021Release notes
Open source →- Add
try_convandtry_castmethods (#12) - Add
try_conv_nearestetc. (#12) - Removed
Conv<f64> for f32(#12) - Replaced
assert_rangeandassert_non_negwithassert_int(#12) - MSRV is 1.32.0 (#12)
- Add
-
0.3.030 Mar 2021Release notes
Open source →- Add
conv_trunc/cast_trunc(#11) - Explicitly support Rust 1.36.0 (and potentially older; #10)
- Support
no_std(#10) - Fix rounding for
flooron negative values (#10)
- Add
-
0.2.020 Mar 2021Release notes
Open source →- Add feature flags controlling assert behaviour
- Remove restrictions on isize/usize (#6)
- Fix bad revert checks (#6)
-
0.1.018 Mar 2021Nothing published for this version