use crate::syn::ast::{Stmt, Expr}; pub trait Visit { type Out; fn visit>(&mut self, acceptor: &A) -> Self::Out where Self: Sized { acceptor.accept(self) } fn visit_stmt(&mut self, stmt: &Stmt) -> Self::Out; fn visit_expr(&mut self, expr: &Expr) -> Self::Out; } pub trait Accept { fn accept(&self, visitor: &mut V) -> V::Out; } impl Accept for Stmt { fn accept(&self, visitor: &mut V) -> V::Out { visitor.visit_stmt(self) } } impl Accept for Expr { fn accept(&self, visitor: &mut V) -> V::Out { visitor.visit_expr(self) } }