blob: 987235ea4fa14e5a31193cf0f601c324f92d0257 [file] [log] [blame]
David Tolnay4b4c4b62018-01-06 13:48:05 -08001//! This crate automatically generates the definition of the `Visit`,
2//! `VisitMut`, and `Fold` traits in `syn` based on the `syn` source. It
Nika Layzell27726662017-10-24 23:16:35 -04003//! discovers structs and enums declared with the `ast_*` macros and generates
4//! the functions for those types.
5//!
6//! It makes a few assumptions about the target crate:
7//! 1. All structs which are discovered must be re-exported in the root of the
8//! crate, even if they were declared in a submodule.
9//! 2. This code cannot discover submodules which are located in subdirectories
10//! - only submodules located in the same directory.
11//! 3. The path to `syn` is hardcoded.
12
David Tolnay6af48992018-08-01 11:16:28 -070013#![recursion_limit = "128"]
David Tolnayc1f55792018-11-21 01:39:42 -080014#![allow(clippy::needless_pass_by_value)]
David Tolnayea9ae892017-12-26 01:44:32 -050015
Carl Lerche058ff472019-02-13 16:23:52 -080016mod gen;
Carl Lerche9a7d5882019-02-15 12:27:04 -080017mod json;
Carl Lerche058ff472019-02-13 16:23:52 -080018mod parse;
19mod types;
David Tolnay8c81f622018-07-31 23:34:35 -070020
Nika Layzell27726662017-10-24 23:16:35 -040021fn main() {
Carl Lerche058ff472019-02-13 16:23:52 -080022 let types = parse::parse();
23 gen::generate(&types);
Carl Lerche9a7d5882019-02-15 12:27:04 -080024 json::generate(&types);
Nika Layzell27726662017-10-24 23:16:35 -040025}