Implement printf formatting for some parser types

This commit is contained in:
Johannes Altmanninger 2023-04-01 19:15:39 +02:00
parent dc4cb84ffc
commit 915db44fbd
2 changed files with 12 additions and 0 deletions

View file

@ -322,6 +322,12 @@ impl From<ParseKeyword> for &'static wstr {
}
}
impl printf_compat::args::ToArg<'static> for ParseKeyword {
fn to_arg(self) -> printf_compat::args::Arg<'static> {
printf_compat::args::Arg::Str(self.into())
}
}
fn keyword_description(keyword: ParseKeyword) -> wcharz_t {
let s: &'static wstr = keyword.into();
wcharz!(s)

View file

@ -258,6 +258,12 @@ impl From<TokenizerError> for &'static wstr {
}
}
impl printf_compat::args::ToArg<'static> for TokenizerError {
fn to_arg(self) -> printf_compat::args::Arg<'static> {
printf_compat::args::Arg::Str(self.into())
}
}
impl Tok {
fn new(r#type: TokenType) -> Tok {
Tok {