-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consuming build but by mut setters? #321
Comments
By the way, I checked with profiling and in my case the clone calls for those Vecs do not get optimised away unfortunately. |
This should be straightforward to implement. APIWe'd allow setting the Implementation
|
This allows a builder to have mutating setters and an owned build method, removing the need to do clones during construction. Fixes #321
Looking at this again, I'm now second-guessing my original thought on the API. It feels like it might be better for the top-level |
Okay, so I think the reason this is proving more challenging than expected is that the current behavior of the Currently, that field can be set on the struct or on a field. The strange part is how setting it on a field interacts with the |
It seems
#[builder(pattern = "owned")]
changes the behaviour of both the build function as well as the setters. I would like to decouple that:The pattern looks something like this in pseudo-rust:
This is leaving out proper error handling etc for clarity, but it is there in the real thing.
The text was updated successfully, but these errors were encountered: