pub struct ANum<'a> {
pub base: ANumBase,
pub dat: &'a str,
}Expand description
Integral Number
Fields
base: ANumBasedat: &'a strImplementations
sourceimpl<'a> ANum<'a>
impl<'a> ANum<'a>
sourcepub fn radix(&self) -> u32
pub fn radix(&self) -> u32
Get the radix of the data, which is either 2 (binary), 10 (decimal) or 16 (hexadecimal)
sourcepub fn raw_data(&self) -> &'a str
pub fn raw_data(&self) -> &'a str
Get the data associated with the number, which depending on the radix is either binary, decimal and hexadecimal. it also might contains _ separators
sourcepub fn digits(&self) -> String
pub fn digits(&self) -> String
Get the digits associated with the number, which depending on the radix is either binary, decimal and hexadecimal. The ‘_’ characters are filtered away
sourcepub fn to_u8(&self) -> Result<u8, ParseIntError>
pub fn to_u8(&self) -> Result<u8, ParseIntError>
Try to parse the ANum into a u8, which will raise an error if there’s an overflow
sourcepub fn to_u16(&self) -> Result<u16, ParseIntError>
pub fn to_u16(&self) -> Result<u16, ParseIntError>
Try to parse the ANum into a u16, which will raise an error if there’s an overflow
sourcepub fn to_u32(&self) -> Result<u32, ParseIntError>
pub fn to_u32(&self) -> Result<u32, ParseIntError>
Try to parse the ANum into a u32, which will raise an error if there’s an overflow
sourcepub fn to_u64(&self) -> Result<u64, ParseIntError>
pub fn to_u64(&self) -> Result<u64, ParseIntError>
Try to parse the ANum into a u64, which will raise an error if there’s an overflow
sourcepub fn to_u128(&self) -> Result<u128, ParseIntError>
pub fn to_u128(&self) -> Result<u128, ParseIntError>
Try to parse the ANum into a u128, which will raise an error if there’s an overflow
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for ANum<'a>
impl<'a> Send for ANum<'a>
impl<'a> Sync for ANum<'a>
impl<'a> Unpin for ANum<'a>
impl<'a> UnwindSafe for ANum<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more