| 1 | use crate::{formatting::FormattingFlags, parse_utils::StrRawness}; |
| 2 | |
| 3 | mod errors; |
| 4 | |
| 5 | mod parsing; |
| 6 | |
| 7 | #[cfg (test)] |
| 8 | mod tests; |
| 9 | |
| 10 | pub(crate) use self::errors::{ParseError, ParseErrorKind}; |
| 11 | |
| 12 | #[derive (Debug, PartialEq)] |
| 13 | pub(crate) struct FormatStr { |
| 14 | pub(crate) list: Vec<FmtStrComponent>, |
| 15 | } |
| 16 | |
| 17 | #[derive (Debug, PartialEq)] |
| 18 | pub(crate) enum FmtStrComponent { |
| 19 | Str(String, StrRawness), |
| 20 | Arg(FmtArg), |
| 21 | } |
| 22 | |
| 23 | /// An argument in the format string eg: `"{foo:?}"` |
| 24 | #[derive (Debug, PartialEq)] |
| 25 | pub(crate) struct FmtArg { |
| 26 | pub(crate) which_arg: WhichArg, |
| 27 | pub(crate) formatting: FormattingFlags, |
| 28 | pub(crate) rawness: StrRawness, |
| 29 | } |
| 30 | |
| 31 | #[derive (Debug, PartialEq)] |
| 32 | pub(crate) enum WhichArg { |
| 33 | Ident(String), |
| 34 | Positional(Option<usize>), |
| 35 | } |
| 36 | |