pub trait IntTraits: Default {
    type IntType: TryFrom<BigInt> + Into<BigInt> + Copy;

    const IS_SMALL: bool;
    const GENERIC_TYPE_ID: GenericTypeId;
    const CONST: &'static str;
    const EQUAL: &'static str;
    const TO_FELT252: &'static str;
    const TRY_FROM_FELT252: &'static str;
}
Expand description

Trait for implementing integers.

Required Associated Types§

source

type IntType: TryFrom<BigInt> + Into<BigInt> + Copy

The rust matching type to this type.

Required Associated Constants§

source

const IS_SMALL: bool

Is the type smaller than 128 bits. Relevant since some implementations are different due to range check being 128 bits based.

source

const GENERIC_TYPE_ID: GenericTypeId

The generic type id for this type.

source

const CONST: &'static str

The generic libfunc id for getting a const of this type.

source

const EQUAL: &'static str

The generic libfunc id for comparing equality.

source

const TO_FELT252: &'static str

The generic libfunc id for conversion to felt252.

source

const TRY_FROM_FELT252: &'static str

The generic libfunc id for conversion from felt252.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl IntTraits for Sint128Traits

§

type IntType = i128

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = false

source§

const CONST: &'static str = "i128_const"

source§

const EQUAL: &'static str = "i128_eq"

source§

const TO_FELT252: &'static str = "i128_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "i128_try_from_felt252"

source§

impl IntTraits for Sint8Traits

§

type IntType = i8

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "i8_const"

source§

const EQUAL: &'static str = "i8_eq"

source§

const TO_FELT252: &'static str = "i8_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "i8_try_from_felt252"

source§

impl IntTraits for Sint16Traits

§

type IntType = i16

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "i16_const"

source§

const EQUAL: &'static str = "i16_eq"

source§

const TO_FELT252: &'static str = "i16_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "i16_try_from_felt252"

source§

impl IntTraits for Sint32Traits

§

type IntType = i32

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "i32_const"

source§

const EQUAL: &'static str = "i32_eq"

source§

const TO_FELT252: &'static str = "i32_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "i32_try_from_felt252"

source§

impl IntTraits for Sint64Traits

§

type IntType = i64

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "i64_const"

source§

const EQUAL: &'static str = "i64_eq"

source§

const TO_FELT252: &'static str = "i64_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "i64_try_from_felt252"

source§

impl IntTraits for Uint128Traits

§

type IntType = u128

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = false

source§

const CONST: &'static str = "u128_const"

source§

const EQUAL: &'static str = "u128_eq"

source§

const TO_FELT252: &'static str = "u128_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "u128_try_from_felt252"

source§

impl IntTraits for Uint8Traits

§

type IntType = u8

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "u8_const"

source§

const EQUAL: &'static str = "u8_eq"

source§

const TO_FELT252: &'static str = "u8_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "u8_try_from_felt252"

source§

impl IntTraits for Uint16Traits

§

type IntType = u16

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "u16_const"

source§

const EQUAL: &'static str = "u16_eq"

source§

const TO_FELT252: &'static str = "u16_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "u16_try_from_felt252"

source§

impl IntTraits for Uint32Traits

§

type IntType = u32

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "u32_const"

source§

const EQUAL: &'static str = "u32_eq"

source§

const TO_FELT252: &'static str = "u32_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "u32_try_from_felt252"

source§

impl IntTraits for Uint64Traits

§

type IntType = u64

source§

const GENERIC_TYPE_ID: GenericTypeId = _

source§

const IS_SMALL: bool = true

source§

const CONST: &'static str = "u64_const"

source§

const EQUAL: &'static str = "u64_eq"

source§

const TO_FELT252: &'static str = "u64_to_felt252"

source§

const TRY_FROM_FELT252: &'static str = "u64_try_from_felt252"