rust-typed-builder
rust-typed-builder copied to clipboard
Introduce base builder type-alias
It's quite handy to have an alias rather than manually recreating the internal type.
fn make_builder() -> FooBuilder<((), (), (), ())> { .. }
// vs
fn make_builder() -> FooBuilder { .. }
- Why would you ever need to specifically address the base builder type? I can imagine wanting to write a function that returns the builder with some fields filled in, or accept a builder with some fields filled in, or a struct that stores the builder with some fields filled in - but these all are not the base builder. The base builder itself is a fancy unit type.
- If you still want to do it - wouldn't it be simpler to use Default Generic Type Parameters?.
- I'd like to expose the type in my API, in particular builder for http client. Apparently the other, more generic option would be adding a trait, but that perhaps quite a big change.
- That sounds better, try to look at this.