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

Fixes #67 This PR adds support for the `PostBuild` trait, which allows users to perform custom validation when the `.build()` method is called. The validation runs as the last step...

Closes #44 This would support the example in #44 ```rust #[derive(TypedBuilder)] struct Foo { #[builder(default = 12)] x: T, } ``` *if and only if* a default generic type is...

It's quite handy to have an alias rather than manually recreating the internal type. ```rust fn make_builder() -> FooBuilder { .. } // vs fn make_builder() -> FooBuilder { .....

This is only a proof of concept right now, and has many rough edges. I decided to make a draft PR early to discuss this more easily. Thanks for your...

subj --- This change is [](https://reviewable.io/reviews/idanarye/rust-typed-builder/5)

the idea is you have something like ```rust use typed_builder::TypedBuilder; #[derive(TypedBuilder)] struct HasGeneric { x: i32, #[builder(default_generic(T: Default, Default::default()))] y: T } ``` which effectively replaces some of the fake...

Is there a way to mark all Option fields as default? I have a struct with about 30 optional fields and just 2 non-optional fields (I'm parsing/creating a specific type...

Is it possible (would it be possible?) to have each field validated when it is added? It could look something like `Foo::builder().x(1).try_into().y(2).try_into().z(3).try_into().build();`.

I want something like this: ```rust pub struct S { x: i32, y: i32, } impl S { fn check_rep(&self) { assert!(self.x < self.y); } } ``` When `.build()` is...

It would be nice there is a `builder(flatten)` to merge 2 structs into one builder. ```rust #[derive(TypedBuilder)] struct A { a: String, } #[derive(TypedBuilder)] struct A { #[builder(flatten)] shared: A,...