fieldx 0.2.3

Procedural macro for constructing structs with lazily initialized fields, builder pattern, and serde support with a focus on declarative syntax.
Documentation
use fieldx::fxstruct;

#[fxstruct]
#[derive(Clone, PartialEq, Debug)]
struct Bar {
    note: String,
}

#[fxstruct(builder(vis(pub(crate))))]
pub struct Foo {
    #[fieldx(predicate, get(private, as_ref))]
    b1: Bar,
}

impl Foo {}

#[test]
fn accessors() {
    let foo = Foo::builder().b1(Bar::new()).build().expect("Foo builder failed");

    let b1 = foo.b1();

    assert_eq!(b1, Some(&Bar::new()));
}