| Crates.io | buco_derive |
| lib.rs | buco_derive |
| version | 0.2.0 |
| created_at | 2024-08-20 17:57:06.333788+00 |
| updated_at | 2024-08-20 17:57:06.333788+00 |
| description | Proc-macro for [`buco`](https://github.com/NishantJoshi00/buco.git) crate |
| homepage | |
| repository | https://github.com/NishantJoshi00/buco.git |
| max_upload_size | |
| id | 1345604 |
| size | 12,166 |
A simple crate for implementing builder pattern, while still maintaining the safety and predictability of the Rust compiler.
Add the following to your Cargo.toml:
[dependencies]
buco = "0.1"
use buco::Builder;
#[derive(Builder)]
struct Foo {
a: i32,
b: i32,
c: i32,
}
fn main() {
let foo = Foo::builder()
.set_a(1)
.set_b(2)
.set_c(3)
.build();
assert_eq!(foo.a, 1);
assert_eq!(foo.b, 2);
assert_eq!(foo.c, 3);
}