NumParseTool

Trait NumParseTool 

Source
pub trait NumParseTool: Sized + Copy {
    const ZERO: Self;

    // Required methods
    fn try_from_ascii_decimal(code: u8) -> Option<Self>;
    fn checked_mul_ten(self) -> Result<Self>;
    fn checked_add(self, rhs: Self) -> Result<Self>;
}
Expand description

Helper trait for parsing integers

Required Associated Constants§

Source

const ZERO: Self

Required Methods§

Source

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source

fn checked_mul_ten(self) -> Result<Self>

Source

fn checked_add(self, rhs: Self) -> Result<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 NumParseTool for i8

Source§

const ZERO: Self = 0i8

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for i16

Source§

const ZERO: Self = 0i16

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for i32

Source§

const ZERO: Self = 0i32

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for i64

Source§

const ZERO: Self = 0i64

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for u8

Source§

const ZERO: Self = 0u8

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for u16

Source§

const ZERO: Self = 0u16

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for u32

Source§

const ZERO: Self = 0u32

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Source§

impl NumParseTool for u64

Source§

const ZERO: Self = 0u64

Source§

fn try_from_ascii_decimal(code: u8) -> Option<Self>

Source§

fn checked_mul_ten(self) -> Result<Self>

Source§

fn checked_add(self, rhs: Self) -> Result<Self>

Implementors§