rust_codegen/
lib.rs

1#![deny(missing_debug_implementations, missing_docs)]
2#![doc(html_root_url = "https://docs.rs/rust_codegen/0.1.0")]
3
4//! Provides a builder API for generating Rust code.
5//!
6//! The general strategy for using the crate is as follows:
7//!
8//! 1. Create a `Scope` instance.
9//! 2. Use the builder API to add elements to the scope.
10//! 3. Call `Scope::to_string()` to get the generated code.
11//!
12//! For example:
13//!
14//! ```rust
15//! use rust_codegen::Scope;
16//!
17//! let mut scope = Scope::new();
18//!
19//! scope.new_struct("Foo")
20//!     .derive("Debug")
21//!     .field("one", "usize")
22//!     .field("two", "String");
23//!
24//! println!("{}", scope.to_string());
25//! ```
26
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;
48
49
50pub use associated_type::*;
51pub use block::*;
52pub use field::*;
53pub use formatter::*;
54pub use function::*;
55pub use import::*;
56pub use module::*;
57pub use scope::*;
58pub use variant::*;
59
60pub use r#enum::*;
61pub use r#impl::*;
62pub use r#struct::*;
63pub use r#trait::*;
64pub use r#type::*;