Builders that take &mut self should panic when used a second time #83
dtolnay
started this conversation in
API Guidelines
Replies: 3 comments
-
Why not just consume builder instead? Compile-time checking FTW. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Because then you can't write |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, I see. In that case I'd say consume everything. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you want to support this behavior, provide Clone for the builder.
In general, the user should not be allowed to rely on a builder being in any particular state after calling the terminal method (
build
or similar). If the ergonomics of doing so weren't awful, the terminal method would take self by value instead of &mut self.Beta Was this translation helpful? Give feedback.
All reactions