snarkvm_console_program

Trait IntegerProperties

Source
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 Constants§

Source

const BITS: u64

Returns the number of bits required to represent this integer.

Source

const MAX: Self

Returns the maximum value representable by this integer.

Source

const MIN: Self

Returns the minimum value representable by this integer.

Required Associated Types§

Required Methods§

Source

fn is_signed() -> bool

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

Source

fn type_name() -> &'static str

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

Source

fn into_dual(self) -> Self::Dual

Casts self into its dual.

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 IntegerProperties for i8

Source§

const BITS: u64 = 8u64

Source§

const MAX: i8 = 127i8

Source§

const MIN: i8 = -128i8

Source§

type Dual = u8

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for i16

Source§

const BITS: u64 = 16u64

Source§

const MAX: i16 = 32_767i16

Source§

const MIN: i16 = -32_768i16

Source§

type Dual = u16

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for i32

Source§

const BITS: u64 = 32u64

Source§

const MAX: i32 = 2_147_483_647i32

Source§

const MIN: i32 = -2_147_483_648i32

Source§

type Dual = u32

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for i64

Source§

const BITS: u64 = 64u64

Source§

const MAX: i64 = 9_223_372_036_854_775_807i64

Source§

const MIN: i64 = -9_223_372_036_854_775_808i64

Source§

type Dual = u64

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for i128

Source§

const BITS: u64 = 128u64

Source§

const MAX: i128 = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

Source§

const MIN: i128 = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

Source§

type Dual = u128

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for u8

Source§

const BITS: u64 = 8u64

Source§

const MAX: u8 = 255u8

Source§

const MIN: u8 = 0u8

Source§

type Dual = i8

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for u16

Source§

const BITS: u64 = 16u64

Source§

const MAX: u16 = 65_535u16

Source§

const MIN: u16 = 0u16

Source§

type Dual = i16

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for u32

Source§

const BITS: u64 = 32u64

Source§

const MAX: u32 = 4_294_967_295u32

Source§

const MIN: u32 = 0u32

Source§

type Dual = i32

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for u64

Source§

const BITS: u64 = 64u64

Source§

const MAX: u64 = 18_446_744_073_709_551_615u64

Source§

const MIN: u64 = 0u64

Source§

type Dual = i64

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Source§

impl IntegerProperties for u128

Source§

const BITS: u64 = 128u64

Source§

const MAX: u128 = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

Source§

const MIN: u128 = 0u128

Source§

type Dual = i128

Source§

fn is_signed() -> bool

Source§

fn type_name() -> &'static str

Source§

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

Implementors§