typenum::type_operators

Trait ToInt

Source
pub trait ToInt<T> {
    const INT: T;

    // Required method
    fn to_int() -> T;
}
Expand description

A type operator for taking a concrete integer value from a type.

It returns arbitrary integer value without explicitly specifying the type. It is useful when you pass the values to methods that accept distinct types without runtime casting.

Required Associated Constants§

Source

const INT: T

The concrete value for the type. Can be used in const contexts.

Required Methods§

Source

fn to_int() -> T

Method returning the concrete value for the 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 ToInt<i8> for Z0

Source§

const INT: i8 = 0i8

Source§

impl ToInt<i8> for UTerm

Source§

const INT: i8 = 0i8

Source§

impl ToInt<i16> for Z0

Source§

const INT: i16 = 0i16

Source§

impl ToInt<i16> for UTerm

Source§

const INT: i16 = 0i16

Source§

impl ToInt<i32> for Z0

Source§

const INT: i32 = 0i32

Source§

impl ToInt<i32> for UTerm

Source§

const INT: i32 = 0i32

Source§

impl ToInt<i64> for Z0

Source§

const INT: i64 = 0i64

Source§

impl ToInt<i64> for UTerm

Source§

const INT: i64 = 0i64

Source§

impl ToInt<u8> for UTerm

Source§

const INT: u8 = 0u8

Source§

impl ToInt<u16> for UTerm

Source§

const INT: u16 = 0u16

Source§

impl ToInt<u32> for UTerm

Source§

const INT: u32 = 0u32

Source§

impl ToInt<u64> for UTerm

Source§

const INT: u64 = 0u64

Source§

impl ToInt<usize> for UTerm

Source§

const INT: usize = 0usize

Source§

impl<U> ToInt<i8> for NInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i8 = Self::I8

Source§

impl<U> ToInt<i8> for PInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i8 = Self::I8

Source§

impl<U> ToInt<i16> for NInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i16 = Self::I16

Source§

impl<U> ToInt<i16> for PInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i16 = Self::I16

Source§

impl<U> ToInt<i32> for NInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i32 = Self::I32

Source§

impl<U> ToInt<i32> for PInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i32 = Self::I32

Source§

impl<U> ToInt<i64> for NInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i64 = Self::I64

Source§

impl<U> ToInt<i64> for PInt<U>
where U: Unsigned + NonZero,

Source§

const INT: i64 = Self::I64

Source§

impl<U, B> ToInt<i8> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: i8 = Self::I8

Source§

impl<U, B> ToInt<i16> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: i16 = Self::I16

Source§

impl<U, B> ToInt<i32> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: i32 = Self::I32

Source§

impl<U, B> ToInt<i64> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: i64 = Self::I64

Source§

impl<U, B> ToInt<u8> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: u8 = Self::U8

Source§

impl<U, B> ToInt<u16> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: u16 = Self::U16

Source§

impl<U, B> ToInt<u32> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: u32 = Self::U32

Source§

impl<U, B> ToInt<u64> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: u64 = Self::U64

Source§

impl<U, B> ToInt<usize> for UInt<U, B>
where U: Unsigned, B: Bit,

Source§

const INT: usize = Self::USIZE