项目作者: timsueberkrueb

项目描述 :
Automatically generate Rust code for the Visitor pattern
高级语言: Rust
项目地址: git://github.com/timsueberkrueb/visit.git
创建时间: 2019-02-16T15:23:22Z
项目社区:https://github.com/timsueberkrueb/visit

开源协议:Other

下载


visit

Automatically generate code for the Visitor pattern.

Usage

  1. visit! {
  2. // Automatically generates `Visitor` and `AcceptVisitor` traits
  3. // The `Visitor` trait will contain `visit_<child>` functions for all items inside of the macro call.
  4. // The `AcceptVisitor` trait will be implemented automatically for all items.
  5. #![visitor(name = "Visitor")]
  6. struct Bar {
  7. a: Child,
  8. b: Child,
  9. }
  10. struct Child {}
  11. }
  12. struct MyVisitor;
  13. impl Visitor for MyVisitor {
  14. fn visit_child(&mut self, _child: &Child) {
  15. // Do something cool
  16. }
  17. }

License

visit is licensed under either of the following licenses, at your option: