我如何解构匹配 syntax::ptr::P?
How do I destructuring-match syntax::ptr::P?
我有一个试图匹配 syntax::ast::ExprBinary(syntax::ast::BinOp, syntax::ptr::P<ast::Expr>, syntax::ptr::P<syntax::ast::Expr>)
的函数,但我找不到匹配 P
的正确语法,所以我从中获取了包含的表达式。我看到我可以使用 Deref
来获取 Expr
,但这很麻烦。
有没有办法去掉 match
(或 if let
)子句中的 P
?
无法通过 P
进行模式匹配:the field is private 而且我们还没有通用指针模式匹配(还)。
获取包含数据的唯一方法是 Deref
(对于 &
),以及方法 and_then
和 map
(对于按值) .
我有一个试图匹配 syntax::ast::ExprBinary(syntax::ast::BinOp, syntax::ptr::P<ast::Expr>, syntax::ptr::P<syntax::ast::Expr>)
的函数,但我找不到匹配 P
的正确语法,所以我从中获取了包含的表达式。我看到我可以使用 Deref
来获取 Expr
,但这很麻烦。
有没有办法去掉 match
(或 if let
)子句中的 P
?
无法通过 P
进行模式匹配:the field is private 而且我们还没有通用指针模式匹配(还)。
获取包含数据的唯一方法是 Deref
(对于 &
),以及方法 and_then
和 map
(对于按值) .