Parses an enum pattern with a required path prefix. # Example Input ```text Some(> 30) Event::Click(>= 0, < 100) Ok(== 42) Status::Active // Unit variant (no parens) ``` This assumes the input starts with a path, optionally followed by parenthesized content.
(input: ParseStream)
| 29 | /// |
| 30 | /// This assumes the input starts with a path, optionally followed by parenthesized content. |
| 31 | fn parse(input: ParseStream) -> syn::Result<Self> { |
| 32 | let path: syn::Path = input.parse()?; |
| 33 | |
| 34 | // Check if there are parentheses (tuple variant) or not (unit variant) |
| 35 | let elements = if input.peek(syn::token::Paren) { |
| 36 | let content; |
| 37 | syn::parenthesized!(content in input); |
| 38 | TupleElement::parse_comma_separated(&content)? |
| 39 | } else { |
| 40 | // Unit variant - no elements |
| 41 | vec![] |
| 42 | }; |
| 43 | |
| 44 | Ok(PatternEnum { |
| 45 | node_id: next_node_id(), |
| 46 | path, |
| 47 | elements, |
| 48 | }) |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected