pub struct ANum<'a> {
pub base: ANumBase,
pub dat: &'a str,
}
Expand description
Integral Number
Fields§
§base: ANumBase
§dat: &'a str
Implementations§
Source§impl<'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