Struct gix_config::Integer
source · 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 PartialEq<Integer> for Integer
impl PartialEq<Integer> for Integer
source§impl PartialOrd<Integer> for Integer
impl PartialOrd<Integer> for Integer
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§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