Parses a slice pattern: [pattern, pattern, ...] # Example Input ```text [1, 2, 3] [> 0, < 10, == 5] ```
(input: syn::parse::ParseStream)
| 24 | /// [> 0, < 10, == 5] |
| 25 | /// ``` |
| 26 | fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { |
| 27 | // Capture the span of the `[` token before consuming it. |
| 28 | let span = input.span(); |
| 29 | let content; |
| 30 | syn::bracketed!(content in input); |
| 31 | |
| 32 | // Parse the comma-separated list of patterns |
| 33 | let elements = parse_pattern_list(&content)?; |
| 34 | |
| 35 | Ok(PatternSlice { |
| 36 | node_id: next_node_id(), |
| 37 | span, |
| 38 | elements, |
| 39 | }) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /// Parse a comma-separated list of patterns inside brackets. |
no test coverage detected