Skip to main content

UnsignedInteger

Trait UnsignedInteger 

Source
pub trait UnsignedInteger:
    Integer<Unsigned = Self>
    + From<u8>
    + TryFrom<u128, Error: Debug> {
    const SAFE_DIGITS: usize;

    // Required methods
    fn cast_signed(self) -> Self::Signed;
    fn wrapping_add_signed(self, rhs: Self::Signed) -> Self;
    fn wrapping_sub(self, rhs: Self) -> Self;
}
Expand description

Trait implemented by the primitive unsigned integer types.

Required Associated Constants§

Source

const SAFE_DIGITS: usize

The maximum number of decimal digits which always fit in the type.

Required Methods§

Source

fn cast_signed(self) -> Self::Signed

Source

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source

fn wrapping_sub(self, rhs: Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UnsignedInteger for u8

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

impl UnsignedInteger for u16

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

impl UnsignedInteger for u32

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

impl UnsignedInteger for u64

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

impl UnsignedInteger for u128

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Source§

impl UnsignedInteger for usize

Source§

const SAFE_DIGITS: usize

Source§

fn cast_signed(self) -> Self::Signed

Source§

fn wrapping_add_signed(self, rhs: Self::Signed) -> Self

Source§

fn wrapping_sub(self, rhs: Self) -> Self

Implementors§