idanarye/rust-typed-builder

Convert the builder type's generic params to a tuple

Closed this issue · 0 comments

(see discussion on #16)

Instead of:

pub struct FooBuilder<T1, T2, T3> {
    f1: T1,
    f2: T2,
    f3: T3,
    _TypedBuilder__phantomGenerics_: PhantomData<...>,
}

We should have:

pub struct FooBuilder<F> {
    fields: F,
    phantom: PhantomData<...>,
}

Where F would be (T1, T2, T3).

Using this style would allow transforming F with helper traits (and possibly helper macros) to write forward-compatible impl blocks for the builder type.