blob: fa577cb1a1a4affd14e108887b6c7e974ed8dc7b [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
Nika Layzell27726662017-10-24 23:16:35 -040016extern crate inflections;
David Tolnay2e0dba12017-12-27 01:54:40 -050017extern crate proc_macro2;
David Tolnayd67fb752017-12-27 13:50:29 -050018#[macro_use]
19extern crate quote;
David Tolnay8c81f622018-07-31 23:34:35 -070020extern crate rustfmt_nightly as rustfmt;
Carl Lerche058ff472019-02-13 16:23:52 -080021#[macro_use]
David Tolnay5f794802018-11-24 14:51:21 -080022extern crate syn;
Nika Layzell27726662017-10-24 23:16:35 -040023
Carl Lerche058ff472019-02-13 16:23:52 -080024mod gen;
25mod parse;
26mod types;
David Tolnay8c81f622018-07-31 23:34:35 -070027
Nika Layzell27726662017-10-24 23:16:35 -040028fn main() {
Carl Lerche058ff472019-02-13 16:23:52 -080029 let types = parse::parse();
30 gen::generate(&types);
Nika Layzell27726662017-10-24 23:16:35 -040031}