| Crates.io | codegen |
| lib.rs | codegen |
| version | 0.3.0 |
| created_at | 2017-10-31 21:40:00.566384+00 |
| updated_at | 2025-12-06 07:42:07.738667+00 |
| description | Library for generating Rust code |
| homepage | https://gitlab.com/yovoslav/codegen |
| repository | https://gitlab.com/yovoslav/codegen.git |
| max_upload_size | |
| id | 37608 |
| size | 90,944 |
Provides a builder API to assist in generating Rust code.
More information about this crate can be found in the crate documentation
To use codegen, first add it as a dependency
cargo add codegen
Scope instance.Scope::to_string() to get the generated code.use codegen::Scope;
let mut scope = Scope::new();
scope.new_struct("Foo")
.derive("Debug")
.field("one", "usize")
.field("two", "String");
println!("{}", scope.to_string());
codegen will not attempt to perform anything beyond basic formatting. For
improved formatting, the generated code can be passed to rustfmt.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in codegen by you, shall be licensed as MIT, without any
additional terms or conditions.