pub struct Integer {
pub value: i64,
pub suffix: Option<Suffix>,
}
Expand description
Any value that can be interpreted as an integer.
This supports any numeric value that can fit in a i64
, excluding the
suffix. The suffix is parsed separately from the value itself, so if you
wish to obtain the true value of the integer, you must account for the
suffix after fetching the value. integer::Suffix
provides
bitwise_offset()
to help with the
math, or to_decimal()
for obtaining a usable value in one step.
Fields§
§value: i64
The value, without any suffix modification
suffix: Option<Suffix>
A provided suffix, if any.
Implementations§
Source§impl Integer
impl Integer
Sourcepub fn to_decimal(&self) -> Option<i64>
pub fn to_decimal(&self) -> Option<i64>
Canonicalize values as simple decimal numbers. An optional suffix of k, m, or g (case-insensitive), will cause the value to be multiplied by 1024 (k), 1048576 (m), or 1073741824 (g) respectively.
Returns the result if there is no multiplication overflow.
Trait Implementations§
Source§impl Ord for Integer
impl Ord for Integer
Source§impl PartialOrd for Integer
impl PartialOrd for Integer
Source§impl Serialize for Integer
Available on crate feature serde
only.
impl Serialize for Integer
Available on crate feature
serde
only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Integer
impl Eq for Integer
impl StructuralPartialEq for Integer
Auto Trait Implementations§
impl Freeze for Integer
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnwindSafe for Integer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more