-
Notifications
You must be signed in to change notification settings - Fork 159
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
Implement balance table #285
Conversation
/// assert_eq!(total, 3); | ||
/// ``` | ||
#[inline] | ||
pub fn for_each<F, V>(&self, f: &mut F) -> Result<(), String> |
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.
couldn't impl the Iterator trait instead?
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.
no because all of the elements are not in memory. Also this would be done on top of this, the reason for this is to be able to more closely match the spec.
@@ -129,6 +128,29 @@ where | |||
self.pointers.is_empty() | |||
} | |||
|
|||
pub(crate) fn for_each<V, S, F>(&self, store: &S, f: &mut F) -> Result<(), String> |
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.
couldn't impl the Iterator trait instead?
Summary of changes
Changes introduced in this pull request:
for_each
function on the hamt, which allows passing a function which reads kvs and performs the function on all of them while mutating state outside of the function.Reference issue to close (if applicable)
Closes #278
Other information and links