MCPcopy Index your code
hub / github.com/carllerche/assert-struct / parse

Method parse

assert-struct-macros/src/pattern/slice.rs:26–40  ·  view source on GitHub ↗

Parses a slice pattern: [pattern, pattern, ...] # Example Input ```text [1, 2, 3] [> 0, < 10, == 5] ```

(input: syn::parse::ParseStream)

Source from the content-addressed store, hash-verified

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.

Callers 1

parse_pattern_listFunction · 0.45

Calls 3

parse_pattern_listFunction · 0.85
next_node_idFunction · 0.85
spanMethod · 0.45

Tested by

no test coverage detected