Parses a map pattern: #{ "key": pattern, "key2": pattern, .. } # Example Input ```text #{ "name": "Alice", "age": >= 18 } #{ "key": > 5, .. } ```
(input: syn::parse::ParseStream)
| 25 | /// #{ "key": > 5, .. } |
| 26 | /// ``` |
| 27 | fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { |
| 28 | // Consume the # token |
| 29 | let _: Token![#] = input.parse()?; |
| 30 | |
| 31 | // Capture the span of the `{` token before consuming it. |
| 32 | let span = input.span(); |
| 33 | let content; |
| 34 | syn::braced!(content in input); |
| 35 | |
| 36 | // Parse the map entries |
| 37 | let (entries, rest) = parse_map_entries(&content)?; |
| 38 | |
| 39 | Ok(PatternMap { |
| 40 | node_id: next_node_id(), |
| 41 | span, |
| 42 | entries, |
| 43 | rest, |
| 44 | }) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /// Parse map entries: comma-separated key-value pairs with optional rest pattern |
no test coverage detected