Skip to content
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

Consider making builders chainable #409

Open
dzfranklin opened this issue Jun 10, 2023 · 0 comments
Open

Consider making builders chainable #409

dzfranklin opened this issue Jun 10, 2023 · 0 comments

Comments

@dzfranklin
Copy link
Contributor

That is I want to be able to do

our_feature
   .init_at()
   .set_parent(other_parent)
   .set_idx(other_at)

I think this is possibly arguably only a minor breaking change because most users aren't looking at the unit success type currently returned. One usage I could see this breaking would be users manually writing out error propagation with a match. If that's unacceptable this could be yet another conditional thing in codegen.rs, although the permutations might be getting a bit out of hand there.

Concretely I think this would be implemented by changing the infallible setters from fn set_foo(&mut self, arg: Reader) to fn set_foo(&mut self, arg: Reader) -> &mut Self and the fallible setters to fn set_foo(self, arg: Reader) -> capnp::Result<&mut Self>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant