MCPcopy Create free account
hub / github.com/carllerche/assert-struct / parse

Method parse

assert-struct-macros/src/pattern/comparison.rs:42–60  ·  view source on GitHub ↗
(input: syn::parse::ParseStream)

Source from the content-addressed store, hash-verified

40
41impl Parse for ComparisonOp {
42 fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
43 // Check compound operators before their single-char prefixes, since
44 // peek(Token![<]) also matches the `<` in `<=`.
45 if input.peek(Token![<=]) {
46 Ok(ComparisonOp::LessEqual(input.parse()?))
47 } else if input.peek(Token![<]) {
48 Ok(ComparisonOp::Less(input.parse()?))
49 } else if input.peek(Token![>=]) {
50 Ok(ComparisonOp::GreaterEqual(input.parse()?))
51 } else if input.peek(Token![>]) {
52 Ok(ComparisonOp::Greater(input.parse()?))
53 } else if input.peek(Token![==]) {
54 Ok(ComparisonOp::Equal(input.parse()?))
55 } else if input.peek(Token![!=]) {
56 Ok(ComparisonOp::NotEqual(input.parse()?))
57 } else {
58 Err(input.error("expected comparison operator (<, <=, >, >=, ==, !=)"))
59 }
60 }
61}
62
63impl Parse for PatternComparison {

Callers

nothing calls this directly

Calls 1

next_node_idFunction · 0.85

Tested by

no test coverage detected