# Codegen
Provides an builder API to assist in generating Rust code.
[![Build Status](https://travis-ci.org/carllerche/codegen.svg?branch=master)](https://travis-ci.org/carllerche/codegen)
More information about this crate can be found in the [crate documentation][dox]
[dox]: https://docs.rs/codegen/0.1.3/codegen/
## Installation
To use `codegen`, first add this to your `Cargo.toml`:
```toml
[dependencies]
codegen = "0.1.3"
```
Next, add this to your crate:
```rust
extern crate codegen;
```
## Usage
1) Create a `Scope` instance.
2) Use the builder API to add elements to the scope.
3) Call `Scope::to_string()` to get the generated code.
For example:
```rust
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](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.
没有合适的资源?快使用搜索试试~ 我知道了~
codegen_Rust库,提供用于生成Rust代码的构建器API 开发技术.zip
共28个文件
rs:22个
md:2个
gitignore:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 151 浏览量
2023-10-26
11:47:15
上传
评论
收藏 25KB ZIP 举报
温馨提示
codegen_Rust库,提供用于生成Rust代码的构建器API 开发技术.zip
资源推荐
资源详情
资源评论
收起资源包目录
codegen_Rust库,提供用于生成Rust代码的构建器API 开发技术.zip (28个子文件)
codegen-master
Cargo.toml 520B
.travis.yml 1012B
src
function.rs 7KB
block.rs 2KB
bound.rs 119B
scope.rs 9KB
struct.rs 3KB
lib.rs 1KB
module.rs 5KB
type_def.rs 3KB
fields.rs 3KB
body.rs 383B
variant.rs 1KB
docs.rs 426B
item.rs 339B
trait.rs 4KB
field.rs 1KB
associated_type.rs 361B
import.rs 508B
impl.rs 4KB
enum.rs 2KB
type.rs 2KB
formatter.rs 3KB
LICENSE 1KB
tests
codegen.rs 11KB
CHANGELOG.md 576B
.gitignore 18B
README.md 1KB
L
T
A
5
共 28 条
- 1
资源评论
N201871643
- 粉丝: 907
- 资源: 2289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功