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

Nibbles improvements #208

Merged
merged 2 commits into from
Aug 22, 2023
Merged

Nibbles improvements #208

merged 2 commits into from
Aug 22, 2023

Conversation

rkuris
Copy link
Collaborator

@rkuris rkuris commented Aug 22, 2023

Rather than implement skip() at the Nibbles layer, you get Iter::skip efficiently if you implement Iter::nth. This is trivial to do for Nibbles, and solves the problem of skip(0) on Nibbles::<1>, which now works correctly (test included)

Implementing Iter::size_hint() allows for a size check as well, which makes Nibbles::len() less useful, but I'm keeping it so that size_hint can use it.

Rather than implement skip() at the Nibbles layer, you get `Iter::skip`
efficiently if you implement `Iter::nth`. This is trivial to do for
Nibbles, and solves the problem of `skip(0)` on `Nibbles::<1>`, which
now works correctly (test included)

Implementing `Iter::size_hint()` allows for a size check as well, which
makes `Nibbles::len()` less useful, but I'm keeping it so that
`size_hint` can use it.
Copy link
Contributor

@richardpringle richardpringle left a comment

Choose a reason for hiding this comment

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

LGTM

@rkuris rkuris merged commit a981b6b into main Aug 22, 2023
5 checks passed
@rkuris rkuris deleted the rkuris/nibbles-nom-nom-nom branch August 22, 2023 14:56
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.

2 participants