[][src]Trait tstr::ToUint

pub trait ToUint: Sized {
    pub const USIZE: usize;
    pub const U128: u128;
    pub fn to_usize(&self) -> usize { ... }
pub fn to_u128(&self) -> u128 { ... } }

Converts a TStr to unsigned integers.

Example

use tstr::{ToUint, TS, ts};

type Zero = TS!(0);
type N8   = TS!(8);
type N13  = TS!(13);
type N15  = TS!(0xF);
type N16  = TS!(0b10000);

assert_eq!(Zero::USIZE, 0);
assert_eq!(N8::USIZE, 8);
assert_eq!(N13::USIZE, 13);
assert_eq!(N15::USIZE, 15);
assert_eq!(N16::USIZE, 16);

assert_eq!(ts!(0).to_u128(), 0);
assert_eq!(ts!(8).to_u128(), 8);
assert_eq!(ts!(13).to_u128(), 13);
assert_eq!(ts!(0xF).to_u128(), 15);
assert_eq!(ts!(0b10000).to_u128(), 16);

Associated Constants

pub const USIZE: usize[src]

The usize value of the type.

By default this value is a saturated cast from Self::U128.

pub const U128: u128[src]

The u128 value of the type.

Loading content...

Provided methods

pub fn to_usize(&self) -> usize[src]

Gets the usize value of this type

By default this value is a saturated cast from Self::U128.

pub fn to_u128(&self) -> u128[src]

Gets the u128 value of this type

Loading content...

Implementors

impl<T> ToUint for TStr<T> where
    T: ToUint
[src]

Loading content...