プロジェクト
GitHubで見る
carllerche/codegen
概要
Rustコードを生成するビルダーAPIを提供するRustライブラリです。
開発ツール計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルCodegen
Provides an builder API to assist in generating Rust code.
More information about this crate can be found in the crate documentation
Installation
To use codegen, first add this to your Cargo.toml:
[dependencies]
codegen = "0.1.3"
Next, add this to your crate:
extern crate codegen;
Usage
- Create a
Scopeinstance. - Use the builder API to add elements to the scope.
- Call
Scope::to_string()to get the generated code.
For example:
use codegen::Scope;
let mut scope = Scope::new();
scope.new_struct("Foo")
.derive("Debug")
.field("one", "usize")
.field("two", "String");
println!("{}", scope.to_string());
Non-goals
codegen will not attempt to perform anything beyond basic formatting. For
improved formatting, the generated code can be passed to rustfmt.
License
This project is licensed under the MIT license.
Contribution
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.
関連プロジェクトを探す
読み込み中…