프로젝트
GitHub에서 보기
carllerche/codegen
소개
Rust 코드를 생성하는 빌더 API를 제공하는 Rust 라이브러리입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalCodegen
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.
관련 프로젝트 살펴보기
불러오는 중…