1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
/// High-level code generation logic. mod code; /// Format documentation as rustdoc. mod docstring; /// Finalized code generation. mod postprocessing; /// Actual changes to the filesystem. pub mod filesystem; /// Format codegen. pub mod string_format; /// Track autogenerated files. pub mod track_autogen; pub use code::{code, CodeConfig, StructConfig}; pub use postprocessing::mark_autogen::{add_indent, count_indent}; pub use postprocessing::mark_fmt::add_fmt_skips; /// How many characters per line each autogenerated document should have. const CODE_WIDTH: usize = 80; /// Runtime options for code generation. #[derive(Copy, Clone)] pub struct CodegenConfig { /// Whether or not to mark each generated line of code with the autogeneration comment /// specified by `zamm_yang::codegen::mark_autogen::AUTOGENERATION_MARKER`. pub comment_autogen: bool, /// Whether or not we want Cargo to track autogenerated files and rebuild when they change. pub track_autogen: bool, /// Whether or not we're outputting code for Yin itself. pub yin: bool, /// Whether or not we're outputting code for release. /// /// If we are, the implications are: /// /// * No autogeneration comments, so that documentation looks good on docs.rs /// * No `build.rs`, because there's no network access for builds on docs.rs anyways /// * Autogenerated files will be committed instead of ignored, because they can't be built /// without `build.rs` to do it /// * A release branch will be created, ready for cargo publishing pub release: bool, } impl Default for CodegenConfig { fn default() -> Self { Self { comment_autogen: true, track_autogen: false, yin: false, release: false, } } }