Function parse_identifier_array

Source
pub fn parse_identifier_array<I>(
    iter: &mut I,
    default_span: Span,
    allowed_values: &[&str],
) -> Result<Vec<String>, SpanError>
where I: Iterator<Item = TokenTree>,
Expand description

Parse an array of identifiers.

It expects an array of predefined identifiers.

§Arguments

  • iter: token iterator to consume
  • default_span: span to use when an error was found but can’t be linked to a span.
  • allowed_values: identifiers allowed as values for this array

§Return

The identifiers found for this array.

§Error

  • When the tokens is not a bracket group with identifiers separated by commas
  • When an identifier is not in the allowed identifier list