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

Change iterator API to allow moving items in and out #60

Merged
merged 4 commits into from
Aug 7, 2021

Conversation

mgeier
Copy link
Owner

@mgeier mgeier commented Jul 8, 2021

Closes #56, see the discussion there.

For now, this proposes to add the method WriteChunkUninit::populate(), but we might be able to find a better name?

Please note that this method is only available on uninitialized chunks because it would be unnecessary to fill the slots with their Default value just to overwrite them again with the values from the iterator.

I still have to clarify this (and probably some other things) in the docs.

@mgeier
Copy link
Owner Author

mgeier commented Jul 11, 2021

I've updated the documentation (rendered HTML files as ZIP: https://github.com/mgeier/rtrb/suites/3210578459/artifacts/74262447).

I think the iterator API now makes much more sense than before, but I'm still wondering if we can find a better name than populate() ...

@mgeier mgeier marked this pull request as ready for review July 19, 2021 17:52
@mgeier
Copy link
Owner Author

mgeier commented Jul 19, 2021

I'm still unsure whether populate() is the best name, but so far I couldn't come up with anything better.

I don't think extend() (as suggested in #56 (comment)) is good, because it sounds like the Extend trait but it has slightly different semantics (it doesn't guarantee that the iterator will be fully exhausted). Also it kinda implies that the "container" can grow, which the ring buffer cannot.

Any further ideas?

@mgeier
Copy link
Owner Author

mgeier commented Jul 26, 2021

@mgeier
Copy link
Owner Author

mgeier commented Jul 27, 2021

I've changed populate() (which isn't bad) to fill_from_iter() (which is more explicit). Rendered HTML as ZIP: https://github.com/mgeier/rtrb/suites/3344397678/artifacts/78522609.

@mgeier mgeier merged commit 6b1a435 into mgeier:main Aug 7, 2021
@mgeier mgeier deleted the iterators branch August 7, 2021 15:58
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.

Batch-read that can take ownership of consumed items
1 participant