Expand description
A fantastic crate for fmting numbers using the appropriate unicode characters via the Display trait. ✨
Supports vulgar fractions, super- and subscript.
§Vulgar Fractions
Creates beautiful unicode fractions like ¼ or ¹⁰⁄₃.
assert_eq!("¹⁰⁄₃", format!("{}", VulgarFraction::new(10, 3)));
assert_eq!("¼", format!("{}", VulgarFraction::new(1, 4)));§Sub- and superscript
Formats integers as sub- or superscript.
assert_eq!("x₁", format!("x{}", Subscript(1)));
assert_eq!("n²", format!("n{}", Superscript(2)));§Seven-Segment Digits
Formats an unsigned integer using seven-segment digits from the Legacy Computing block.
assert_eq!("🯶🯲🯸", format!("{}", Segmented(628_u32)));§Tally Marks
Formats an unsigned integer as tally marks.
assert_eq!("𝍷𝍷𝍷", TallyMarks(3_u32).to_string());
assert_eq!("𝍸𝍸𝍷𝍷", TallyMarks(12_u32).to_string());§Ballot Box
Formats a boolean as a ballot box.
assert_eq!("☑ Buy bread", format!("{} Buy bread", BallotBox(true)));
assert_eq!("☐ Do the dishes", format!("{} Do the dishes", BallotBox(false)));
assert_eq!("☒ Laundry", format!("{:#} Laundry", BallotBox(true)));Structs§
- Ballot
Box - Formats a boolean as either a checked or unchecked ballot box.
- Segmented
- Formats an unsigned integer using seven-segment digits from the Legacy Computing block.
- Subscript
- A number that can be formatted as subscript using the
Displaytrait. - Superscript
- A number that can be formatted as superscript using the
Displaytrait. - Tally
Marks - Formats an unsigned integer as tally marks.
- Vulgar
Fraction - A Vulgar Fraction that can be formatted as a unicode fraction using the
Displaytrait.
Traits§
- Integer
- An abstraction over all integer types.
Integers can be formatted as
Subscript,SubscriptorVulgarFraction. - Signed
Integer - Abstraction over signed integer types.
- Unsigned
Integer - Abstraction over unsigned integer types.
Unsigned integers can be formatted as
SegmentedorTallyMarks.