1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//! A **fantastic** crate for **fmt**ing numbers using the appropriate unicode characters via the [`Display`](core::fmt::Display) trait. ✨ \
//! Supports vulgar fractions, super- and subscript.
//!
//! # [Vulgar Fractions]
//! Creates beautiful unicode fractions like ¼ or ¹⁰⁄₃.
//! ```
//! # use fmtastic::VulgarFraction;
//! assert_eq!("¹⁰⁄₃", format!("{}", VulgarFraction::new(10, 3)));
//! assert_eq!("¼", format!("{}", VulgarFraction::new(1, 4)));
//! ```
//!
//! # Sub- and superscript
//! Formats integers as sub- or superscript.
//!
//! ```
//! # use fmtastic::{Subscript, Superscript};
//! assert_eq!("x₁", format!("x{}", Subscript(1)));
//! assert_eq!("n²", format!("n{}", Superscript(2)));
//! ```
//!
//! # Roman Numerals
//! Formats unsigned integers as Roman numerals.
//!
//! ```
//! # use fmtastic::Roman;
//! assert_eq!("ⅾⅽⅽⅼⅹⅹⅹⅰⅹ", format!("{:#}", Roman::new(789_u16).unwrap())); // lowercase
//! assert_eq!("ⅯⅯⅩⅩⅠⅤ", format!("{}", Roman::new(2024_u16).unwrap()));
//! assert_eq!("MMXXIV", format!("{}", Roman::new(2024_u16).unwrap().ascii())); // ascii
//! assert_eq!("ⅠⅠⅠ", format!("{}", Roman::from(3_u8))); // u8's can always be formatted as Roman numeral
//! ```
//!
//! [Vulgar Fractions]: https://en.wikipedia.org/wiki/Fraction_(mathematics)#Simple,_common,_or_vulgar_fractions
//!
//! # Seven-Segment Digits
//! Formats an unsigned integer using seven-segment digits
//! from the [Legacy Computing] block.
//! ```
//! # use fmtastic::Segmented;
//! assert_eq!("🯶🯲🯸", format!("{}", Segmented(628_u32)));
//! ```
//!
//! [Legacy Computing]: https://www.unicode.org/charts/PDF/U1FB00.pdf
//!
//! # Outlined
//! Formats an unsigned integer using outlined digits
//! from the [Legacy Computing Supplement] block.
//!
//! ```
//! # use fmtastic::Outlined;
//! assert_eq!("", format!("{}", Outlined(628_u32)));
//! ```
//!
//! [Legacy Computing Supplement]: https://www.unicode.org/charts/PDF/U1CC00.pdf
//!
//! # Tally Marks
//! Formats an unsigned integer as tally marks.
//!
//! ```
//! # use fmtastic::TallyMarks;
//! assert_eq!("𝍷𝍷𝍷", TallyMarks(3_u32).to_string());
//! assert_eq!("𝍸𝍸𝍷𝍷", TallyMarks(12_u32).to_string());
//! ```
//!
//! # Ballot Box
//! Formats a boolean as a ballot box.
//!
//! ```
//! # use fmtastic::BallotBox;
//! 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)));
//! ```
/// An abstraction over all integer types.
/// Integers can be formatted as [`Subscript`], [`Subscript`] or [`VulgarFraction`].
///
/// Use this trait if you want to abstract over integers that can be formatted
/// by one of this crate's formats:
///
/// ```
/// use fmtastic::{Subscript, Integer};
///
/// assert_eq!("x₁", x_with_index(1u8));
/// assert_eq!("x₅", x_with_index(5u64));
///
/// fn x_with_index<T: Integer>(index: T) -> String {
/// format!("x{}", Subscript(index))
/// }
/// ```
/// Abstraction over signed integer types.
/// Abstraction over unsigned integer types.
/// Unsigned integers can be formatted as [`Segmented`] or [`TallyMarks`].
pub
pub
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;