[][src]Function proc_macro_util::parse_flags

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

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)