-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add new constructors #49
Conversation
Is the use of array references (rather than slices) in the constructors unnecessarily limiting for the caller? |
I don't think so, because these functions are called with the assumption that the caller knows what the payload is, hence, the array size is known (or should be checked at compile time). bitcoin-bosd/src/descriptor.rs Line 73 in 99923f6
EDIT: Also taking slices would mean that all these easy constructors (apart from OP_RETURN) would need to return |
Understood. I was thinking of it more from the caller's perspective, where it would undoubtedly like to avoid an extra copy if it doesn't have the input value as an array already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit.
4044d26
to
d5daf8f
Compare
Gonna leave this until tomorrow so that @bewakes can also take a look if he wants to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tests would be a good idea for a future PR as well.
They are in the docstrings with the hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add tiny unit tests for these? If you think it's too trivial then its fine but it would really be great, for example we might be constructing a different variant than the constructor method intends to.
Oops, just saw this. |
Description
new_*
constructors from the different payload types.Type of Change
Checklist
Related Issues
Closes #48.