Function parse_keyed_strings

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

Parse strings identified by keys

§Argument

  • input: token iterator to consume
  • default_span: span to use when an error is detected but can’t be linked to a span
  • keys: keys to search for

§Return

An hash map with the key that were detected with their associated value. The value contains the quote that makes the string literal.

§Error

  • When a key was detected but can’t be parsed as a string literal assignment

§Example

(my_val = "toto"), then the value of identifier my_valisr#““toto”“#`.