cairo_lang_sierra::extensions::modules::int

Trait IntTraits

source
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 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.

Required Associated Types§

source

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

The rust matching type to this type.

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.

Implementors§

source§

impl IntTraits for Sint128Traits

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§

type IntType = i128

source§

impl IntTraits for Sint8Traits

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§

type IntType = i8

source§

impl IntTraits for Sint16Traits

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§

type IntType = i16

source§

impl IntTraits for Sint32Traits

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§

type IntType = i32

source§

impl IntTraits for Sint64Traits

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§

type IntType = i64

source§

impl IntTraits for Uint128Traits

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§

type IntType = u128

source§

impl IntTraits for Uint8Traits

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§

type IntType = u8

source§

impl IntTraits for Uint16Traits

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§

type IntType = u16

source§

impl IntTraits for Uint32Traits

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§

type IntType = u32

source§

impl IntTraits for Uint64Traits

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"

source§

type IntType = u64