codegen/
lib.rs

1#![deny(missing_debug_implementations, missing_docs)]
2
3//! Provides a builder API for generating Rust code.
4//!
5//! The general strategy for using the crate is as follows:
6//!
7//! 1. Create a `Scope` instance.
8//! 2. Use the builder API to add elements to the scope.
9//! 3. Call `Scope::to_string()` to get the generated code.
10//!
11//! For example:
12//!
13//! ```rust
14//! use codegen::Scope;
15//!
16//! let mut scope = Scope::new();
17//!
18//! scope.new_struct("Foo")
19//!     .derive("Debug")
20//!     .field("one", "usize")
21//!     .field("two", "String");
22//!
23//! println!("{}", scope.to_string());
24//! ```
25
26mod associated_const;
27mod associated_type;
28mod block;
29mod body;
30mod bound;
31mod docs;
32mod field;
33mod fields;
34mod formatter;
35mod function;
36mod import;
37mod item;
38mod module;
39mod scope;
40mod type_def;
41mod variant;
42
43mod r#enum;
44mod r#impl;
45mod r#struct;
46mod r#trait;
47mod r#type;
48mod type_alias;
49
50pub use associated_const::*;
51pub use associated_type::*;
52pub use block::*;
53pub use field::*;
54pub use formatter::*;
55pub use function::*;
56pub use import::*;
57pub use module::*;
58pub use scope::*;
59pub use variant::*;
60
61pub use r#enum::*;
62pub use r#impl::*;
63pub use r#struct::*;
64pub use r#trait::*;
65pub use r#type::*;