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 for Integer
impl PartialEq for Integer
source§impl PartialOrd for Integer
impl PartialOrd 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
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)