pub struct Int(_, _);Expand description
Human readable integer.
From takes an unsigned number as input and returns a ready-to-print!() Int.
f32 or f64 inputs will work, but the fractional parts will be ignored.
Exceptions
| Exceptions | String Output |
|---|---|
f64::NAN | NaN |
f64::INFINITY & f64::NEG_INFINITY | ∞ |
To disable checks for these, (you are sure you don’t have NaN’s), enable the ignore_nan_inf feature flag.
Examples
| Input | Output |
|---|---|
0 | 0 |
1 | 1 |
999 | 999 |
1000 | 1,000 |
1234567 | 1,234,567 |
100000000 | 100,000,000 |
1.123 | 1 |
2000.123 | 2,000 |
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Int
impl<'de> Deserialize<'de> for Int
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Int
impl Ord for Int
source§impl PartialOrd<Int> for Int
impl PartialOrd<Int> for Int
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 moreimpl Eq for Int
impl StructuralEq for Int
impl StructuralPartialEq for Int
Auto Trait Implementations§
impl RefUnwindSafe for Int
impl Send for Int
impl Sync for Int
impl Unpin for Int
impl UnwindSafe for Int
Blanket Implementations§
source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere T: Display,
source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more