pub trait UnboundedShr: Sized + Shr<u32> {
// Required method
fn unbounded_shr(self, rhs: u32) -> <Self as Shr<u32>>::Output;
}Expand description
Performs a right shift that never panics, shifting in zero or sign bits for large shift amounts.
Required Methods§
Sourcefn unbounded_shr(self, rhs: u32) -> <Self as Shr<u32>>::Output
fn unbounded_shr(self, rhs: u32) -> <Self as Shr<u32>>::Output
Unbounded shift right. Computes self >> rhs, without bounding the
value of rhs: if rhs >= BITS, unsigned values become 0 and signed
values become 0 or -1 depending on the sign (the sign bit fills every
position).
use const_num_traits::UnboundedShr;
assert_eq!(UnboundedShr::unbounded_shr(16u8, 4), 1);
assert_eq!(UnboundedShr::unbounded_shr(16u8, 200), 0);
assert_eq!(UnboundedShr::unbounded_shr(-16i8, 200), -1);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".