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§
sourcefn from_radix(data: &str, radix: u8, sep: &str) -> Option<Self>
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.
sourcefn checked_neg(self) -> Option<Self>
fn checked_neg(self) -> Option<Self>
Equivalent to std
’s checked_neg()
.
Object Safety§
This trait is not object safe.