pub fn parse_format_string(fmt: &str) -> Result<Vec<FormatElement<'_>>>Expand description
Parses a string to a vector of FormatElement
Takes a printf-style format string fmt
use sprintf::parser::{
parse_format_string, ConversionSpecifier, ConversionType, FormatElement, NumericParam,
};
let fmt = "Hello %#06x";
let parsed = parse_format_string(fmt).unwrap();
assert_eq!(parsed[0], FormatElement::Verbatim("Hello "));
assert_eq!(
parsed[1],
FormatElement::Format(ConversionSpecifier {
alt_form: true,
zero_pad: true,
left_adj: false,
space_sign: false,
force_sign: false,
width: NumericParam::Literal(6),
precision: NumericParam::Literal(6),
conversion_type: ConversionType::HexIntLower,
})
);