Trait ilex::token::FromRadix

source ·
pub trait FromRadix: Sized {
    // Required methods
    fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>;
    fn checked_neg(self) -> Option<Self>;
}
Expand description

A base 2 integer type of portable size that can be parsed from any radix.

Required Methods§

source

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

Parses a value from data, given it’s in a particular radix.

The result must be exact: truncation or rounding are not permitted. Occurrences thereof must be signaled by returning None.

The implementation may assume that radix is in 2..=16, and that the the only bytes that occur in data are 0..=9, a..=f, and A..=F, as would be implied by the value of radix; also, the byte sequence in sep may appear, which should be ignored.

source

fn checked_neg(self) -> Option<Self>

Equivalent to std’s checked_neg().

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromRadix for i8

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for i16

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for i32

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for i64

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for i128

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for u8

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for u16

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for u32

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for u64

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

source§

impl FromRadix for u128

source§

fn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>

source§

fn checked_neg(self) -> Option<Self>

Implementors§