Trait num_traits::ops::wrapping::WrappingShl [−][src]
pub trait WrappingShl: Sized + Shl<usize, Output = Self> { fn wrapping_shl(&self, rhs: u32) -> Self; }
Performs a left shift that does not panic.
Required methods
fn wrapping_shl(&self, rhs: u32) -> Self
[src]
Panic-free bitwise shift-left; yields self << mask(rhs)
,
where mask
removes any high order bits of rhs
that would
cause the shift to exceed the bitwidth of the type.
use num_traits::WrappingShl; let x: u16 = 0x0001; assert_eq!(WrappingShl::wrapping_shl(&x, 0), 0x0001); assert_eq!(WrappingShl::wrapping_shl(&x, 1), 0x0002); assert_eq!(WrappingShl::wrapping_shl(&x, 15), 0x8000); assert_eq!(WrappingShl::wrapping_shl(&x, 16), 0x0001);
Implementations on Foreign Types
impl WrappingShl for u8
[src]
fn wrapping_shl(&self, rhs: u32) -> u8
[src]
impl WrappingShl for u16
[src]
fn wrapping_shl(&self, rhs: u32) -> u16
[src]
impl WrappingShl for u32
[src]
fn wrapping_shl(&self, rhs: u32) -> u32
[src]
impl WrappingShl for u64
[src]
fn wrapping_shl(&self, rhs: u32) -> u64
[src]
impl WrappingShl for usize
[src]
fn wrapping_shl(&self, rhs: u32) -> usize
[src]
impl WrappingShl for u128
[src]
fn wrapping_shl(&self, rhs: u32) -> u128
[src]
impl WrappingShl for i8
[src]
fn wrapping_shl(&self, rhs: u32) -> i8
[src]
impl WrappingShl for i16
[src]
fn wrapping_shl(&self, rhs: u32) -> i16
[src]
impl WrappingShl for i32
[src]
fn wrapping_shl(&self, rhs: u32) -> i32
[src]
impl WrappingShl for i64
[src]
fn wrapping_shl(&self, rhs: u32) -> i64
[src]
impl WrappingShl for isize
[src]
fn wrapping_shl(&self, rhs: u32) -> isize
[src]
impl WrappingShl for i128
[src]
fn wrapping_shl(&self, rhs: u32) -> i128
[src]
impl<T: WrappingShl> WrappingShl for Wrapping<T> where
Wrapping<T>: Shl<usize, Output = Wrapping<T>>,
[src]
Wrapping<T>: Shl<usize, Output = Wrapping<T>>,