Trait Unsigned

Source
pub trait Unsigned:
    Sealed
    + Copy
    + Default
    + 'static {
    const U8: u8;
    const U16: u16;
    const U32: u32;
    const U64: u64;
    const U128: u128;
    const USIZE: usize;
    const I8: i8;
    const I16: i16;
    const I32: i32;
    const I64: i64;
    const I128: i128;
    const ISIZE: isize;

    // Required methods
    fn to_u8() -> u8;
    fn to_u16() -> u16;
    fn to_u32() -> u32;
    fn to_u64() -> u64;
    fn to_u128() -> u128;
    fn to_usize() -> usize;
    fn to_i8() -> i8;
    fn to_i16() -> i16;
    fn to_i32() -> i32;
    fn to_i64() -> i64;
    fn to_i128() -> i128;
    fn to_isize() -> isize;
}
Expand description

The marker trait for compile time unsigned integers.

§Example

use typenum::{Unsigned, U3};

assert_eq!(U3::to_u32(), 3);
assert_eq!(U3::I32, 3);

Required Associated Constants§

Source

const U8: u8

Source

const U16: u16

Source

const U32: u32

Source

const U64: u64

Source

const U128: u128

Available on crate feature i128 only.
Source

const USIZE: usize

Source

const I8: i8

Source

const I16: i16

Source

const I32: i32

Source

const I64: i64

Source

const I128: i128

Available on crate feature i128 only.
Source

const ISIZE: isize

Required Methods§

Source

fn to_u8() -> u8

Source

fn to_u16() -> u16

Source

fn to_u32() -> u32

Source

fn to_u64() -> u64

Source

fn to_u128() -> u128

Available on crate feature i128 only.
Source

fn to_usize() -> usize

Source

fn to_i8() -> i8

Source

fn to_i16() -> i16

Source

fn to_i32() -> i32

Source

fn to_i64() -> i64

Source

fn to_i128() -> i128

Available on crate feature i128 only.
Source

fn to_isize() -> isize

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 Unsigned for UTerm

Source§

const U8: u8 = 0u8

Source§

const U16: u16 = 0u16

Source§

const U32: u32 = 0u32

Source§

const U64: u64 = 0u64

Source§

const U128: u128 = 0u128

Source§

const USIZE: usize = 0usize

Source§

const I8: i8 = 0i8

Source§

const I16: i16 = 0i16

Source§

const I32: i32 = 0i32

Source§

const I64: i64 = 0i64

Source§

const I128: i128 = 0i128

Source§

const ISIZE: isize = 0isize

Source§

impl<U: Unsigned, B: Bit> Unsigned for UInt<U, B>