Function parse_flags

Source
pub fn parse_flags(
    input: impl IntoIterator<Item = TokenTree>,
    default_span: Span,
    allowed_flags: &[&str],
) -> Result<HashSet<String>, SpanError>
Expand description

Parse tokens as flags toggles

This will search in the provided token iterator input for specific identifier that will toggle on a flag.

§Arguments

  • input: token iterator to consume
  • default_span: span to use when an error occurs and can’t be linked to a span
  • allowed_flags: identifiers that are parsed as flags

§Return

An hash set of toggled flags.

§Errors

if a flag is found but is not parsed as a flag. (Usually followed by a = token, which is invalid for a flag)