rust-typed-builder icon indicating copy to clipboard operation
rust-typed-builder copied to clipboard

Compile-time type-checked builder derive

Results 34 rust-typed-builder issues
Sort by recently updated
recently updated
newest added

Is it possible to customize a setter for initializing a couple of fields? For example, I want the builder being able to accept a different struct that contains some information...

It would be great if I could say something along the lines of: ```rust #[derive(TypedBuilder)] struct Foo { #[group(a)] #[default] bar: Option, #[group(a)] #[default] baz: Option, #[default] bat: Option, }...

Hi! Currently `strip_option` prevents the actual setting of `None`, forcing to use two code paths when one wants to maybe build with `None`. I propose the following. When using `strip_option`,...

As a concrete example, when creating a customer in the Stripe API, there’s an argument `tax_percent` that is only permitted if `plan` has also been set. It is an error...

The name of builder methods are the "snake_case" of variant names. Note that it does not support enums with generics or lifetime.

Is there a way to add additional generics bounds on field setters? This would help in cases where setting bounds in the `struct` definition is annoying (which is most of...

I have an example use case that either does not work currently, or I am deeply misunderstanding the documentation ;-) ```rust #[derive(Debug, TypedBuilder)] struct CalendarEvent { #[builder(setter(into))] title: String, //...

The [`format_ident!`](https://docs.rs/quote/latest/quote/macro.format_ident.html) macro saves us the code for stripping `r#`.

I use the builder pattern mainly to emulate named arguments. But I don't want to have to call `build`. ## What I must do currently ```rust DoSomething::builder() .foo(foo) .bar(bar) .build()...

- Add `#![forbid(rust_2018_idioms)]` to the `typed-builder-macro` crate - Make the builder function const when possible