Skip to content

hrp len const fn#212

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
anoma:tomas/const-hrp-len
Feb 9, 2025
Merged

hrp len const fn#212
apoelstra merged 1 commit intorust-bitcoin:masterfrom
anoma:tomas/const-hrp-len

Conversation

@tzemanovic
Copy link
Copy Markdown
Contributor

makes the Hrp::len a const fn

Copy link
Copy Markdown
Member

@clarkmoody clarkmoody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 72ad45a

@tcharding
Copy link
Copy Markdown
Member

What is the motivation? Just because we can and its better? If so perhaps we do FieldVec::len at the same time. I checked all the other len functions and they are all ExactSizedIterator trait methods so cannot be const.

@apoelstra
Copy link
Copy Markdown
Member

Every pure function should be const, unless there are compiler limitations (such as them being trait methods) that prevent it, or we expect to run into compiler limitations with future refactorings.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 72ad45a; successfully ran local tests

@apoelstra apoelstra merged commit a19e843 into rust-bitcoin:master Feb 9, 2025
@nazar-pc
Copy link
Copy Markdown

Could someone publish a new release with this change, please?

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

Successfully merging this pull request may close these issues.

5 participants