WrappingNegtrait will wrap the result if it exceeds the boundary of the type, e.g.
i32::MIN.wrapping_neg() == i32::MIN.
SaturatingMultraits will saturate at the numeric bounds if the operation would overflow. These soft-deprecate the existing
Saturatingtrait that only has addition and subtraction methods.
Contributors: @cuviper, @ocstl, @trepetti, @vallentin
Contributors: @cuviper, @m-ou-se
libmdependency enables the
clamp_maxlimit minimum and maximum values while preserving input
from_str_radixon invalid signs.
Contributors: @cuviper, @dingelish, @HeroicKatora, @jturner314, @ocstl, @Shnatsel, @termoshtt, @waywardmonkeys, @yoanlcq
One::set_onewill set values to their identities in place, possibly optimized better than direct assignment.
Contributors: @cuviper, @dvdhrm, @ignatenkobrain, @lcnr, @samueltardieu
1. Mathematically, this is not strictly defined, but the current behavior is a pragmatic choice that has precedent in Rust
corefor the primitives and in many other languages.
WrappingShrtraits will wrap the shift count if it exceeds the bit size of the type.
Contributors: @cuviper, @edmccard, @meltinglava
mul_addnow clarifies that it's not always faster.
ToPrimitiveare more robust.
Contributors: @cuviper, @frewsxcv
i128crate feature now causes the build script to panic if such support is not detected.
CheckedRemtraits perform checked
f32now uses a constant for greater accuracy, mirroring rust#47919. (With
stdit just calls the inherent
f32::to_degreesin the standard library.)
MulAddAssigntraits perform a fused multiply- add. For integer types this is just a convenience, but for floating point types this produces a more accurate result than the separate operations.
i128crate feature. The
ToPrimitivetraits now also have corresponding 128-bit methods, which default to converting via 64-bit integers for compatibility.
Contributors: @cuviper, @LEXUGE, @regexident, @vks
Noneon overflow, avoiding rustc's undefined behavior. This applies to the
castfunction and the traits
Contributors: @apopiak, @cuviper, @dbarella
FloatCoretrait offers a subset of
#![no_std]use. This includes everything except the transcendental functions and FMA.
Invtrait returns the multiplicative inverse, or reciprocal.
Powtrait performs exponentiation, much like the existing
powfunction, but with generic exponent types.
One::is_onemethod tests if a value equals 1. Implementers should override this method if there's a more efficient way to check for 1, rather than comparing with a temporary
Contributors: @clarcharr, @cuviper, @vks
stdfeature, enabled by default, along with the implication that building without this feature makes this a
Realtraits are only available when
Contributors: @cuviper, @termoshtt, @vks
AsPrimitivetrait implements generic casting with the
CheckedShrtraits implement generic support for the
checked_shrmethods on primitive integers.
Realtrait offers a subset of
Floatfunctionality that may be applicable to more types, with a blanket implementation for all existing
Thanks to @cuviper, @Enet4, @fabianschuiki, @svartalf, and @yoanlcq for their contributions!
No prior release notes were kept. Thanks all the same to the many contributors that have made this crate what it is!