Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
campeis committed Dec 30, 2023
1 parent 96c9284 commit 82193bb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,23 @@ use type_safe_builder_macro::Builder;
#[derive(Builder)]
#[builder(multi)]
struct Struct {
#[builder(single)]
field: String,
#[builder(single)]
other_field: String,
}

fn main() {
let build = StructBuilder::builder()
.field("this can't be overridden".into())
.other_field("value for other field".into())
.other_field("value that will override the value of other_field".into())
.field("value for field".into())
.field("value that will override the value of field".into())
.other_field("this can't be overridden".into())
.build(); // this will work

let build = StructBuilder::builder()
.field("value for field".into())
.field("value that will override the value of field".into())
.other_field("this can't be overridden".into())
.other_field("trying to overrid the value".into()) // this will not compile
.build();
}
```

0 comments on commit 82193bb

Please sign in to comment.