We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 231aea6 commit 760c71dCopy full SHA for 760c71d
src/libsyntax/ast_util.rs
@@ -560,6 +560,21 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat) -> bool) -> bool {
560
}
561
562
563
+pub trait EachViewItem {
564
+ pub fn each_view_item(&self, f: @fn(@ast::view_item) -> bool) -> bool;
565
+}
566
+
567
+impl EachViewItem for ast::crate {
568
+ fn each_view_item(&self, f: @fn(@ast::view_item) -> bool) -> bool {
569
+ let broke = @mut false;
570
+ let vtor: visit::vt<()> = visit::mk_simple_visitor(@visit::SimpleVisitor {
571
+ visit_view_item: |vi| { *broke = f(vi); }, ..*visit::default_simple_visitor()
572
+ });
573
+ visit::visit_crate(self, (), vtor);
574
+ true
575
+ }
576
577
578
pub fn view_path_id(p: @view_path) -> node_id {
579
match p.node {
580
view_path_simple(_, _, id) |
0 commit comments