pub trait IntegerProperties: PrimInt + Debug + Display {
    type Dual: IntegerType;

    const BITS: u64;
    const MAX: Self;
    const MIN: Self;

    // Required methods
    fn is_signed() -> bool;
    fn type_name() -> &'static str;
    fn into_dual(self) -> Self::Dual;
}
Expand description

Properties common to all integer types.

Required Associated Types§

Required Associated Constants§

const BITS: u64

Returns the number of bits required to represent this integer.

const MAX: Self

Returns the maximum value representable by this integer.

const MIN: Self

Returns the minimum value representable by this integer.

Required Methods§

fn is_signed() -> bool

Returns true if Self is a signed integer and false otherwise.

fn type_name() -> &'static str

Returns the name of the integer type as a string slice. (i.e. “u8”)

fn into_dual(self) -> Self::Dual

Casts self into its dual.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl IntegerProperties for i8

§

type Dual = u8

§

const BITS: u64 = 8u64

§

const MAX: i8 = 127i8

§

const MIN: i8 = -128i8

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <i8 as IntegerProperties>::Dual

§

impl IntegerProperties for i16

§

type Dual = u16

§

const BITS: u64 = 16u64

§

const MAX: i16 = 32_767i16

§

const MIN: i16 = -32_768i16

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <i16 as IntegerProperties>::Dual

§

impl IntegerProperties for i32

§

type Dual = u32

§

const BITS: u64 = 32u64

§

const MAX: i32 = 2_147_483_647i32

§

const MIN: i32 = -2_147_483_648i32

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <i32 as IntegerProperties>::Dual

§

impl IntegerProperties for i64

§

type Dual = u64

§

const BITS: u64 = 64u64

§

const MAX: i64 = 9_223_372_036_854_775_807i64

§

const MIN: i64 = -9_223_372_036_854_775_808i64

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <i64 as IntegerProperties>::Dual

§

impl IntegerProperties for i128

§

type Dual = u128

§

const BITS: u64 = 128u64

§

const MAX: i128 = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

§

const MIN: i128 = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <i128 as IntegerProperties>::Dual

§

impl IntegerProperties for u8

§

type Dual = i8

§

const BITS: u64 = 8u64

§

const MAX: u8 = 255u8

§

const MIN: u8 = 0u8

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <u8 as IntegerProperties>::Dual

§

impl IntegerProperties for u16

§

type Dual = i16

§

const BITS: u64 = 16u64

§

const MAX: u16 = 65_535u16

§

const MIN: u16 = 0u16

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <u16 as IntegerProperties>::Dual

§

impl IntegerProperties for u32

§

type Dual = i32

§

const BITS: u64 = 32u64

§

const MAX: u32 = 4_294_967_295u32

§

const MIN: u32 = 0u32

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <u32 as IntegerProperties>::Dual

§

impl IntegerProperties for u64

§

type Dual = i64

§

const BITS: u64 = 64u64

§

const MAX: u64 = 18_446_744_073_709_551_615u64

§

const MIN: u64 = 0u64

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <u64 as IntegerProperties>::Dual

§

impl IntegerProperties for u128

§

type Dual = i128

§

const BITS: u64 = 128u64

§

const MAX: u128 = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

§

const MIN: u128 = 0u128

§

fn is_signed() -> bool

§

fn type_name() -> &'static str

§

fn into_dual(self) -> <u128 as IntegerProperties>::Dual

Implementors§