Skip to content

Automatically generate Rust code for the Visitor pattern

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

timsueberkrueb/visit

Repository files navigation

visit

Automatically generate code for the Visitor pattern.

Usage

visit! {
    // Automatically generates `Visitor` and `AcceptVisitor` traits
    // The `Visitor` trait will contain `visit_<child>` functions for all items inside of the macro call.
    // The `AcceptVisitor` trait will be implemented automatically for all items.
    #![visitor(name = "Visitor")]

    struct Bar {
        a: Child,
        b: Child,
    }

    struct Child {}
}

struct MyVisitor;

impl Visitor for MyVisitor {
    fn visit_child(&mut self, _child: &Child) {
        // Do something cool
    }
}

License

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

About

Automatically generate Rust code for the Visitor pattern

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages