Trait Integer

Source
pub trait Integer:
    Copy
    + Clone
    + FromStr
    + Debug
    + Ord
    + Eq
    + Zero
    + One
    + AsPrimitive<u32>
    + WrappingAdd
    + WrappingSub
    + WrappingMul
    + WrappingNeg
    + WrappingShl
    + WrappingShr
    + BitAnd<Self, Output = Self>
    + BitOr<Self, Output = Self>
    + BitXor<Self, Output = Self>
    + Div<Self, Output = Self>
    + Rem<Self, Output = Self>
    + Not<Output = Self>
    + From<bool> {
    // Required methods
    fn wrapping_pow(self, exp: u32) -> Self;
    fn count_ones(self) -> Self;
    fn count_zeros(self) -> Self;
    fn leading_zeros(self) -> Self;
    fn trailing_zeros(self) -> Self;
    fn abs(self) -> Self;
    fn abs_diff(self, other: Self) -> Self;
    fn rotate_left(self, n: u32) -> Self;
    fn rotate_right(self, n: u32) -> Self;
}
Expand description

Definition of who can be used as a numerical value Currently the immediately available types are primitive integer type (u8, u16, u32, u64, usize, i8, i16, i32, i64, isize)

Required Methods§

Source

fn wrapping_pow(self, exp: u32) -> Self

Source

fn count_ones(self) -> Self

Source

fn count_zeros(self) -> Self

Source

fn leading_zeros(self) -> Self

Source

fn trailing_zeros(self) -> Self

Source

fn abs(self) -> Self

Source

fn abs_diff(self, other: Self) -> Self

Source

fn rotate_left(self, n: u32) -> Self

Source

fn rotate_right(self, n: u32) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Integer for i8

Source§

fn wrapping_pow(self, exp: u32) -> i8

Source§

fn count_ones(self) -> i8

Source§

fn count_zeros(self) -> i8

Source§

fn leading_zeros(self) -> i8

Source§

fn trailing_zeros(self) -> i8

Source§

fn abs(self) -> i8

Source§

fn abs_diff(self, other: i8) -> i8

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for i16

Source§

fn wrapping_pow(self, exp: u32) -> i16

Source§

fn count_ones(self) -> i16

Source§

fn count_zeros(self) -> i16

Source§

fn leading_zeros(self) -> i16

Source§

fn trailing_zeros(self) -> i16

Source§

fn abs(self) -> i16

Source§

fn abs_diff(self, other: i16) -> i16

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for i32

Source§

fn wrapping_pow(self, exp: u32) -> i32

Source§

fn count_ones(self) -> i32

Source§

fn count_zeros(self) -> i32

Source§

fn leading_zeros(self) -> i32

Source§

fn trailing_zeros(self) -> i32

Source§

fn abs(self) -> i32

Source§

fn abs_diff(self, other: i32) -> i32

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for i64

Source§

fn wrapping_pow(self, exp: u32) -> i64

Source§

fn count_ones(self) -> i64

Source§

fn count_zeros(self) -> i64

Source§

fn leading_zeros(self) -> i64

Source§

fn trailing_zeros(self) -> i64

Source§

fn abs(self) -> i64

Source§

fn abs_diff(self, other: i64) -> i64

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for isize

Source§

fn wrapping_pow(self, exp: u32) -> isize

Source§

fn count_ones(self) -> isize

Source§

fn count_zeros(self) -> isize

Source§

fn leading_zeros(self) -> isize

Source§

fn trailing_zeros(self) -> isize

Source§

fn abs(self) -> isize

Source§

fn abs_diff(self, other: isize) -> isize

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for u8

Source§

fn wrapping_pow(self, exp: u32) -> u8

Source§

fn count_ones(self) -> u8

Source§

fn count_zeros(self) -> u8

Source§

fn leading_zeros(self) -> u8

Source§

fn trailing_zeros(self) -> u8

Source§

fn abs(self) -> u8

Source§

fn abs_diff(self, other: u8) -> u8

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for u16

Source§

fn wrapping_pow(self, exp: u32) -> u16

Source§

fn count_ones(self) -> u16

Source§

fn count_zeros(self) -> u16

Source§

fn leading_zeros(self) -> u16

Source§

fn trailing_zeros(self) -> u16

Source§

fn abs(self) -> u16

Source§

fn abs_diff(self, other: u16) -> u16

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for u32

Source§

fn wrapping_pow(self, exp: u32) -> u32

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

fn abs(self) -> u32

Source§

fn abs_diff(self, other: u32) -> u32

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for u64

Source§

fn wrapping_pow(self, exp: u32) -> u64

Source§

fn count_ones(self) -> u64

Source§

fn count_zeros(self) -> u64

Source§

fn leading_zeros(self) -> u64

Source§

fn trailing_zeros(self) -> u64

Source§

fn abs(self) -> u64

Source§

fn abs_diff(self, other: u64) -> u64

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

impl Integer for usize

Source§

fn wrapping_pow(self, exp: u32) -> usize

Source§

fn count_ones(self) -> usize

Source§

fn count_zeros(self) -> usize

Source§

fn leading_zeros(self) -> usize

Source§

fn trailing_zeros(self) -> usize

Source§

fn abs(self) -> usize

Source§

fn abs_diff(self, other: usize) -> usize

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Implementors§