IntTypes

Trait IntTypes 

Source
pub trait IntTypes:
    PrimInt
    + NumCast
    + ConstZero
    + ConstOne
    + WrappingAdd
    + WrappingNeg
    + Copy {
    type SignedType: PrimInt + Signed + ConstZero + ConstOne + Copy + NumCast;
    type UnsignedType: PrimInt + Unsigned + ConstZero + ConstOne + Copy + NumCast + WrappingNeg;
    type OtherSignType: PrimInt + ConstOne + ConstZero + Copy + NumCast;

    // Required method
    fn abs_as_unsigned(a: Self) -> Self::UnsignedType;
}
Expand description

Primitive integer types

Mappings to associated signed and unsigned types with the same bit width.

Required Associated Types§

Required Methods§

Source

fn abs_as_unsigned(a: Self) -> Self::UnsignedType

abs() function which returns a corresponding unsigned type

For unsigned input types, just return the same value. For signed types, return the unsigned type of the same bit width.

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

Source§

impl IntTypes for i16

Source§

impl IntTypes for i32

Source§

impl IntTypes for i64

Source§

impl IntTypes for i128

Source§

impl IntTypes for isize

Source§

impl IntTypes for u8

Source§

impl IntTypes for u16

Source§

impl IntTypes for u32

Source§

impl IntTypes for u64

Source§

impl IntTypes for u128

Source§

impl IntTypes for usize

Implementors§