Currently, num_traits::WrappingShl and WrappingShr are implemented for numeric types. So are the ShlVartime/ShrVartime traits which also have corresponding wrapping shift methods (but vartime).
The method description in num_traits matches the one for u32::wrapping_shl and related standard-library methods, which "masks off" the high bits of the shift. This means that N.wrapping_shl(N::BITS) == N.wrapping_shl(0) == N. This does not correspond with the behaviour in the library, which returns N::ZERO when the shift exceeds the maximum size (for types other than Limb). The standard library calls this unbounded_shl/unbounded_shr (new as of Rust 1.87).
Currently,
num_traits::WrappingShlandWrappingShrare implemented for numeric types. So are theShlVartime/ShrVartimetraits which also have corresponding wrapping shift methods (but vartime).The method description in
num_traitsmatches the one foru32::wrapping_shland related standard-library methods, which "masks off" the high bits of the shift. This means thatN.wrapping_shl(N::BITS) == N.wrapping_shl(0) == N. This does not correspond with the behaviour in the library, which returnsN::ZEROwhen the shift exceeds the maximum size (for types other than Limb). The standard library calls thisunbounded_shl/unbounded_shr(new as of Rust 1.87).