Readable
Human readable data formatting.
This crate turns various data into human-readable strings.
Most of the internal strings are implemented as fixed length, stack allocated arrays that are Copy
-able.
Feature flags
Flag | Purpose |
---|---|
serde |
Enables serde on all types |
ignore_nan_inf |
Disables checking f64 's for f64::NAN , f64::INFINITY , and f64::NEG_INFINITY |
inline_date |
Inlines any Date that is in YYYY-MM-HH format and is between year 1900-2100 |
inline_time |
Inlines any Time that is under 1 hour, 1 minute (0..=3660 ) |
inline_runtime |
Inlines ALL of Runtime (0:00..99:59:59 /0..359999 ) |
full |
Enables everything above |
Warning: The inline_*
features are disabled by default. While they increase speed,
they also heavily increase build time and binary size.
Unsigned integers:
let a = from;
assert!;
assert!;
Signed integers:
let a = from;
assert!;
assert!;
Floats:
let a = from;
assert!;
assert!;
Percents:
let a = from;
assert!;
assert!;
Runtime:
let a = from;
assert!;
assert!;
Time:
let a = from;
assert!;
assert!;
Date:
let a = from_str.unwrap;
assert!;
assert!;
Comparison
All types implement Display
, PartialEq
, PartialEq<&str>
and PartialEq
for their inner number primitive.
Example 1:
let a = from_secs;
let b = from;
assert!;
This is comparing b
's inner String
.
Example 2:
let a = from;
assert!;
This is comparing a
's inner i64
.
Example 3:
let a = from;
let b = from;
assert!;
This compares both the u64
AND String
inside a
and b
.