How do I use the syntax for destructuring-matching :: ptr :: P?

I have a function that is trying to match syntax::ast::ExprBinary(syntax::ast::BinOp, syntax::ptr::P<ast::Expr>, syntax::ptr::P<syntax::ast::Expr>)

, but I cannot find the correct syntax to match P

, so I am getting the contained expression from it. I see what I can use Deref

to access Expr

, but this is cumbersome.

Is there a way to get rid of P

within a sentence match

(or if let



source to share

1 answer

There is no way to match patterns across P

: the field is closed , and we don't have a generic pointer pattern match (yet).

The only ways to access the contained data are Deref

(for &

) and methods and_then

and map

(for value).



All Articles