time::format_description::parse::lexer

Function lex

Source
pub(super) fn lex<const VERSION: usize>(
    input: &[u8],
) -> Lexed<impl Iterator<Item = Result<Token<'_>, Error>>> 
Available on (crate features formatting or parsing) and crate feature alloc only.
Expand description

Parse the string into a series of Tokens.

VERSION controls the version of the format description that is being parsed. Currently, this must be 1 or 2.

  • When VERSION is 1, [[ is the only escape sequence, resulting in a literal [.
  • When VERSION is 2, all escape sequences begin with \. The only characters that may currently follow are \, [, and ], all of which result in the literal character. All other characters result in a lex error.