buco 0.2.0

A compile-time builder pattern implementation for Rust
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 15.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • NishantJoshi00/buco
    9 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NishantJoshi00

buco (Builder at Compile Time)

A simple crate for implementing builder pattern, while still maintaining the safety and predictability of the Rust compiler.

Usage

Add the following to your Cargo.toml:

[dependencies]
buco = "0.1"

Example

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);
}