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

Make taproot builder more 'productive' in error case #948

Open
JeremyRubin opened this issue Apr 11, 2022 · 0 comments
Open

Make taproot builder more 'productive' in error case #948

JeremyRubin opened this issue Apr 11, 2022 · 0 comments

Comments

@JeremyRubin
Copy link
Contributor

Why is this important if the function takes ownership of the value?

The inner API from_node_info needs to consume the value. I think it is idiomatic of the builder pattern to consume values and generate new values.

It would be dropped in the error, no?

Yes, but this was in the previous case when the builder was empty. Perhaps, the correct thing to do here(and other builder APIs) is to return to the previous builder state in the error value.

Originally posted by @sanket1729 in #936 (comment)

I think we should probably have a thing that is Result<FinishedT, Result<Self, Error>> or introduce a custom type (so that we don't have issues with ? composition) Finishable<FinishedT, UnfinishedT, Error> that represents a continuable computation.

We can then better model all our builders where we can model the tri-state finished/continue/break with error.

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