lexical_util::num

Trait AsPrimitive

Source
pub trait AsPrimitive:
    Copy
    + PartialEq
    + PartialOrd
    + Send
    + Sync
    + Sized {
Show 16 methods // Required methods fn as_u8(self) -> u8; fn as_u16(self) -> u16; fn as_u32(self) -> u32; fn as_u64(self) -> u64; fn as_u128(self) -> u128; fn as_usize(self) -> usize; fn as_i8(self) -> i8; fn as_i16(self) -> i16; fn as_i32(self) -> i32; fn as_i64(self) -> i64; fn as_i128(self) -> i128; fn as_isize(self) -> isize; fn as_f32(self) -> f32; fn as_f64(self) -> f64; fn from_u32(value: u32) -> Self; fn from_u64(value: u64) -> Self;
}
Expand description

Type that can be converted to primitive with as.

Required Methods§

Source

fn as_u8(self) -> u8

Source

fn as_u16(self) -> u16

Source

fn as_u32(self) -> u32

Source

fn as_u64(self) -> u64

Source

fn as_u128(self) -> u128

Source

fn as_usize(self) -> usize

Source

fn as_i8(self) -> i8

Source

fn as_i16(self) -> i16

Source

fn as_i32(self) -> i32

Source

fn as_i64(self) -> i64

Source

fn as_i128(self) -> i128

Source

fn as_isize(self) -> isize

Source

fn as_f32(self) -> f32

Source

fn as_f64(self) -> f64

Source

fn from_u32(value: u32) -> Self

Source

fn from_u64(value: u64) -> Self

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 AsPrimitive for f32

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for f64

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for i8

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for i16

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for i32

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for i64

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for i128

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for isize

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for u8

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for u16

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for u32

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for u64

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for u128

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Source§

impl AsPrimitive for usize

Source§

fn as_u8(self) -> u8

Source§

fn as_u16(self) -> u16

Source§

fn as_u32(self) -> u32

Source§

fn as_u64(self) -> u64

Source§

fn as_u128(self) -> u128

Source§

fn as_usize(self) -> usize

Source§

fn as_i8(self) -> i8

Source§

fn as_i16(self) -> i16

Source§

fn as_i32(self) -> i32

Source§

fn as_i64(self) -> i64

Source§

fn as_i128(self) -> i128

Source§

fn as_isize(self) -> isize

Source§

fn as_f32(self) -> f32

Source§

fn as_f64(self) -> f64

Source§

fn from_u32(value: u32) -> Self

Source§

fn from_u64(value: u64) -> Self

Implementors§