Struct std::num::Wrapping [] [src]

pub struct Wrapping<T>(pub T);

Provides intentionally-wrapped arithmetic on T.

Operations like + on u32 values is intended to never overflow, and in some debug configurations overflow is detected and results in a panic. While most arithmetic falls into this category, some code explicitly expects and relies upon modular arithmetic (e.g., hashing).

Wrapping arithmetic can be achieved either through methods like wrapping_add, or through the Wrapping<T> type, which says that all standard arithmetic operations on the underlying value are intended to have wrapping semantics.

Trait Implementations

impl Shl<usize> for Wrapping<u8>

type Output = Wrapping<u8>

fn shl(self, other: usize) -> Wrapping<u8>

impl Shr<usize> for Wrapping<u8>

type Output = Wrapping<u8>

fn shr(self, other: usize) -> Wrapping<u8>

impl Shl<usize> for Wrapping<u16>

type Output = Wrapping<u16>

fn shl(self, other: usize) -> Wrapping<u16>

impl Shr<usize> for Wrapping<u16>

type Output = Wrapping<u16>

fn shr(self, other: usize) -> Wrapping<u16>

impl Shl<usize> for Wrapping<u32>

type Output = Wrapping<u32>

fn shl(self, other: usize) -> Wrapping<u32>

impl Shr<usize> for Wrapping<u32>

type Output = Wrapping<u32>

fn shr(self, other: usize) -> Wrapping<u32>

impl Shl<usize> for Wrapping<u64>

type Output = Wrapping<u64>

fn shl(self, other: usize) -> Wrapping<u64>

impl Shr<usize> for Wrapping<u64>

type Output = Wrapping<u64>

fn shr(self, other: usize) -> Wrapping<u64>

impl Shl<usize> for Wrapping<usize>

type Output = Wrapping<usize>

fn shl(self, other: usize) -> Wrapping<usize>

impl Shr<usize> for Wrapping<usize>

type Output = Wrapping<usize>

fn shr(self, other: usize) -> Wrapping<usize>

impl Shl<usize> for Wrapping<i8>

type Output = Wrapping<i8>

fn shl(self, other: usize) -> Wrapping<i8>

impl Shr<usize> for Wrapping<i8>

type Output = Wrapping<i8>

fn shr(self, other: usize) -> Wrapping<i8>

impl Shl<usize> for Wrapping<i16>

type Output = Wrapping<i16>

fn shl(self, other: usize) -> Wrapping<i16>

impl Shr<usize> for Wrapping<i16>

type Output = Wrapping<i16>

fn shr(self, other: usize) -> Wrapping<i16>

impl Shl<usize> for Wrapping<i32>

type Output = Wrapping<i32>

fn shl(self, other: usize) -> Wrapping<i32>

impl Shr<usize> for Wrapping<i32>

type Output = Wrapping<i32>

fn shr(self, other: usize) -> Wrapping<i32>

impl Shl<usize> for Wrapping<i64>

type Output = Wrapping<i64>

fn shl(self, other: usize) -> Wrapping<i64>

impl Shr<usize> for Wrapping<i64>

type Output = Wrapping<i64>

fn shr(self, other: usize) -> Wrapping<i64>

impl Shl<usize> for Wrapping<isize>

type Output = Wrapping<isize>

fn shl(self, other: usize) -> Wrapping<isize>

impl Shr<usize> for Wrapping<isize>

type Output = Wrapping<isize>

fn shr(self, other: usize) -> Wrapping<isize>

impl Add<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn add(self, other: Wrapping<usize>) -> Wrapping<usize>

impl Sub<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn sub(self, other: Wrapping<usize>) -> Wrapping<usize>

impl Mul<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn mul(self, other: Wrapping<usize>) -> Wrapping<usize>

impl Div<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn div(self, other: Wrapping<usize>) -> Wrapping<usize>

impl Not for Wrapping<usize>

type Output = Wrapping<usize>

fn not(self) -> Wrapping<usize>

impl BitXor<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn bitxor(self, other: Wrapping<usize>) -> Wrapping<usize>

impl BitOr<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn bitor(self, other: Wrapping<usize>) -> Wrapping<usize>

impl BitAnd<Wrapping<usize>> for Wrapping<usize>

type Output = Wrapping<usize>

fn bitand(self, other: Wrapping<usize>) -> Wrapping<usize>

impl Add<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn add(self, other: Wrapping<u8>) -> Wrapping<u8>

impl Sub<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn sub(self, other: Wrapping<u8>) -> Wrapping<u8>

impl Mul<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn mul(self, other: Wrapping<u8>) -> Wrapping<u8>

impl Div<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn div(self, other: Wrapping<u8>) -> Wrapping<u8>

impl Not for Wrapping<u8>

type Output = Wrapping<u8>

fn not(self) -> Wrapping<u8>

impl BitXor<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn bitxor(self, other: Wrapping<u8>) -> Wrapping<u8>

impl BitOr<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn bitor(self, other: Wrapping<u8>) -> Wrapping<u8>

impl BitAnd<Wrapping<u8>> for Wrapping<u8>

type Output = Wrapping<u8>

fn bitand(self, other: Wrapping<u8>) -> Wrapping<u8>

impl Add<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn add(self, other: Wrapping<u16>) -> Wrapping<u16>

impl Sub<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn sub(self, other: Wrapping<u16>) -> Wrapping<u16>

impl Mul<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn mul(self, other: Wrapping<u16>) -> Wrapping<u16>

impl Div<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn div(self, other: Wrapping<u16>) -> Wrapping<u16>

impl Not for Wrapping<u16>

type Output = Wrapping<u16>

fn not(self) -> Wrapping<u16>

impl BitXor<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn bitxor(self, other: Wrapping<u16>) -> Wrapping<u16>

impl BitOr<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn bitor(self, other: Wrapping<u16>) -> Wrapping<u16>

impl BitAnd<Wrapping<u16>> for Wrapping<u16>

type Output = Wrapping<u16>

fn bitand(self, other: Wrapping<u16>) -> Wrapping<u16>

impl Add<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn add(self, other: Wrapping<u32>) -> Wrapping<u32>

impl Sub<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn sub(self, other: Wrapping<u32>) -> Wrapping<u32>

impl Mul<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn mul(self, other: Wrapping<u32>) -> Wrapping<u32>

impl Div<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn div(self, other: Wrapping<u32>) -> Wrapping<u32>

impl Not for Wrapping<u32>

type Output = Wrapping<u32>

fn not(self) -> Wrapping<u32>

impl BitXor<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn bitxor(self, other: Wrapping<u32>) -> Wrapping<u32>

impl BitOr<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn bitor(self, other: Wrapping<u32>) -> Wrapping<u32>

impl BitAnd<Wrapping<u32>> for Wrapping<u32>

type Output = Wrapping<u32>

fn bitand(self, other: Wrapping<u32>) -> Wrapping<u32>

impl Add<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn add(self, other: Wrapping<u64>) -> Wrapping<u64>

impl Sub<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn sub(self, other: Wrapping<u64>) -> Wrapping<u64>

impl Mul<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn mul(self, other: Wrapping<u64>) -> Wrapping<u64>

impl Div<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn div(self, other: Wrapping<u64>) -> Wrapping<u64>

impl Not for Wrapping<u64>

type Output = Wrapping<u64>

fn not(self) -> Wrapping<u64>

impl BitXor<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn bitxor(self, other: Wrapping<u64>) -> Wrapping<u64>

impl BitOr<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn bitor(self, other: Wrapping<u64>) -> Wrapping<u64>

impl BitAnd<Wrapping<u64>> for Wrapping<u64>

type Output = Wrapping<u64>

fn bitand(self, other: Wrapping<u64>) -> Wrapping<u64>

impl Add<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn add(self, other: Wrapping<isize>) -> Wrapping<isize>

impl Sub<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn sub(self, other: Wrapping<isize>) -> Wrapping<isize>

impl Mul<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn mul(self, other: Wrapping<isize>) -> Wrapping<isize>

impl Div<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn div(self, other: Wrapping<isize>) -> Wrapping<isize>

impl Not for Wrapping<isize>

type Output = Wrapping<isize>

fn not(self) -> Wrapping<isize>

impl BitXor<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn bitxor(self, other: Wrapping<isize>) -> Wrapping<isize>

impl BitOr<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn bitor(self, other: Wrapping<isize>) -> Wrapping<isize>

impl BitAnd<Wrapping<isize>> for Wrapping<isize>

type Output = Wrapping<isize>

fn bitand(self, other: Wrapping<isize>) -> Wrapping<isize>

impl Add<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn add(self, other: Wrapping<i8>) -> Wrapping<i8>

impl Sub<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn sub(self, other: Wrapping<i8>) -> Wrapping<i8>

impl Mul<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn mul(self, other: Wrapping<i8>) -> Wrapping<i8>

impl Div<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn div(self, other: Wrapping<i8>) -> Wrapping<i8>

impl Not for Wrapping<i8>

type Output = Wrapping<i8>

fn not(self) -> Wrapping<i8>

impl BitXor<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn bitxor(self, other: Wrapping<i8>) -> Wrapping<i8>

impl BitOr<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn bitor(self, other: Wrapping<i8>) -> Wrapping<i8>

impl BitAnd<Wrapping<i8>> for Wrapping<i8>

type Output = Wrapping<i8>

fn bitand(self, other: Wrapping<i8>) -> Wrapping<i8>

impl Add<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn add(self, other: Wrapping<i16>) -> Wrapping<i16>

impl Sub<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn sub(self, other: Wrapping<i16>) -> Wrapping<i16>

impl Mul<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn mul(self, other: Wrapping<i16>) -> Wrapping<i16>

impl Div<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn div(self, other: Wrapping<i16>) -> Wrapping<i16>

impl Not for Wrapping<i16>

type Output = Wrapping<i16>

fn not(self) -> Wrapping<i16>

impl BitXor<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn bitxor(self, other: Wrapping<i16>) -> Wrapping<i16>

impl BitOr<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn bitor(self, other: Wrapping<i16>) -> Wrapping<i16>

impl BitAnd<Wrapping<i16>> for Wrapping<i16>

type Output = Wrapping<i16>

fn bitand(self, other: Wrapping<i16>) -> Wrapping<i16>

impl Add<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn add(self, other: Wrapping<i32>) -> Wrapping<i32>

impl Sub<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn sub(self, other: Wrapping<i32>) -> Wrapping<i32>

impl Mul<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn mul(self, other: Wrapping<i32>) -> Wrapping<i32>

impl Div<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn div(self, other: Wrapping<i32>) -> Wrapping<i32>

impl Not for Wrapping<i32>

type Output = Wrapping<i32>

fn not(self) -> Wrapping<i32>

impl BitXor<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn bitxor(self, other: Wrapping<i32>) -> Wrapping<i32>

impl BitOr<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn bitor(self, other: Wrapping<i32>) -> Wrapping<i32>

impl BitAnd<Wrapping<i32>> for Wrapping<i32>

type Output = Wrapping<i32>

fn bitand(self, other: Wrapping<i32>) -> Wrapping<i32>

impl Add<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn add(self, other: Wrapping<i64>) -> Wrapping<i64>

impl Sub<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn sub(self, other: Wrapping<i64>) -> Wrapping<i64>

impl Mul<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn mul(self, other: Wrapping<i64>) -> Wrapping<i64>

impl Div<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn div(self, other: Wrapping<i64>) -> Wrapping<i64>

impl Not for Wrapping<i64>

type Output = Wrapping<i64>

fn not(self) -> Wrapping<i64>

impl BitXor<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn bitxor(self, other: Wrapping<i64>) -> Wrapping<i64>

impl BitOr<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn bitor(self, other: Wrapping<i64>) -> Wrapping<i64>

impl BitAnd<Wrapping<i64>> for Wrapping<i64>

type Output = Wrapping<i64>

fn bitand(self, other: Wrapping<i64>) -> Wrapping<i64>

Derived Implementations

impl<T> Default for Wrapping<T> where T: Default

fn default() -> Wrapping<T>

impl<T> Debug for Wrapping<T> where T: Debug

fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>

impl<T> Copy for Wrapping<T> where T: Copy

impl<T> Clone for Wrapping<T> where T: Clone

fn clone(&self) -> Wrapping<T>

fn clone_from(&mut self, source: &Self)

impl<T> Ord for Wrapping<T> where T: Ord

fn cmp(&self, __arg_0: &Wrapping<T>) -> Ordering

impl<T> PartialOrd<Wrapping<T>> for Wrapping<T> where T: PartialOrd<T>

fn partial_cmp(&self, __arg_0: &Wrapping<T>) -> Option<Ordering>

fn lt(&self, __arg_0: &Wrapping<T>) -> bool

fn le(&self, __arg_0: &Wrapping<T>) -> bool

fn gt(&self, __arg_0: &Wrapping<T>) -> bool

fn ge(&self, __arg_0: &Wrapping<T>) -> bool

impl<T> Eq for Wrapping<T> where T: Eq

impl<T> PartialEq<Wrapping<T>> for Wrapping<T> where T: PartialEq<T>

fn eq(&self, __arg_0: &Wrapping<T>) -> bool

fn ne(&self, __arg_0: &Wrapping<T>) -> bool