#builder #derive-builder #macro-derive #builder-pattern #derive #macro #design-pattern

macro auto-builder-macro

A derive macro to implement the builder pattern for any struct

2 unstable releases

0.2.0 Jan 21, 2024
0.1.0 Jan 20, 2024

#23 in #derive-builder


Used in auto-builder

MIT license

9KB
146 lines

Crates.io Version GitHub Actions Workflow Status

auto-builder

This crate provides a derive macro that implements the builder pattern for any struct.

#[derive(Builder)]
struct Foo {           
    a: i32,
    b: Option<i32>,
 }

let foo = FooBuilder::new().a(1).b(Some(2)).build();
assert!(foo.is_ok());

Dependencies

~325–780KB
~19K SLoC