Trait UInt

Source
pub trait UInt:
    AsPrimitive<u8>
    + PrimInt
    + Unsigned
    + AddAssign
    + DivAssign
    + Shl<u8, Output = Self>
    + ShlAssign<u8>
    + Shr<u8, Output = Self>
    + ShrAssign<u8>
    + SubAssign<Self>
    + Display {
    const _0: Self;
    const _1: Self;
    const MAX_VALUE: Self;
    const BIT_COUNT: u8 = _;

    // Required method
    fn from_u8(v: u8) -> Self;
}
Expand description

§Examples

use int::UInt;
assert_eq!(u8::BIT_COUNT, 8);
assert_eq!(u16::BIT_COUNT, 16);
assert_eq!(u32::BIT_COUNT, 32);
assert_eq!(u64::BIT_COUNT, 64);
assert_eq!(u128::BIT_COUNT, 128);

Required Associated Constants§

Source

const _0: Self

Source

const _1: Self

Source

const MAX_VALUE: Self

Provided Associated Constants§

Source

const BIT_COUNT: u8 = _

Required Methods§

Source

fn from_u8(v: u8) -> 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 UInt for u8

Source§

const _0: u8 = 0u8

Source§

const _1: u8 = 1u8

Source§

const MAX_VALUE: Self = 255u8

Source§

fn from_u8(v: u8) -> Self

Source§

impl UInt for u16

Source§

const _0: u16 = 0u16

Source§

const _1: u16 = 1u16

Source§

const MAX_VALUE: Self = 65_535u16

Source§

fn from_u8(v: u8) -> Self

Source§

impl UInt for u32

Source§

const _0: u32 = 0u32

Source§

const _1: u32 = 1u32

Source§

const MAX_VALUE: Self = 4_294_967_295u32

Source§

fn from_u8(v: u8) -> Self

Source§

impl UInt for u64

Source§

const _0: u64 = 0u64

Source§

const _1: u64 = 1u64

Source§

const MAX_VALUE: Self = 18_446_744_073_709_551_615u64

Source§

fn from_u8(v: u8) -> Self

Source§

impl UInt for u128

Source§

const _0: u128 = 0u128

Source§

const _1: u128 = 1u128

Source§

const MAX_VALUE: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

Source§

fn from_u8(v: u8) -> Self

Source§

impl UInt for usize

Source§

const _0: usize = 0usize

Source§

const _1: usize = 1usize

Source§

const MAX_VALUE: Self = 4_294_967_295usize

Source§

fn from_u8(v: u8) -> Self

Implementors§