We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 478aa41 commit e11cda9Copy full SHA for e11cda9
common/src/format.rs
@@ -137,6 +137,28 @@ pub enum FormatType {
137
Percentage,
138
}
139
140
+impl From<&FormatType> for char {
141
+ fn from(from: &FormatType) -> char {
142
+ match from {
143
+ FormatType::String => 's',
144
+ FormatType::Binary => 'b',
145
+ FormatType::Character => 'c',
146
+ FormatType::Decimal => 'd',
147
+ FormatType::Octal => 'o',
148
+ FormatType::HexLower => 'x',
149
+ FormatType::HexUpper => 'X',
150
+ FormatType::Number => 'n',
151
+ FormatType::ExponentLower => 'e',
152
+ FormatType::ExponentUpper => 'E',
153
+ FormatType::GeneralFormatLower => 'g',
154
+ FormatType::GeneralFormatUpper => 'G',
155
+ FormatType::FixedPointLower => 'f',
156
+ FormatType::FixedPointUpper => 'F',
157
+ FormatType::Percentage => '%',
158
+ }
159
160
+}
161
+
162
impl FormatParse for FormatType {
163
fn parse(text: &str) -> (Option<Self>, &str) {
164
let mut chars = text.chars();
0 commit comments