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

btree map into_iter #210

Closed
barkanido opened this issue Nov 11, 2024 · 1 comment
Closed

btree map into_iter #210

barkanido opened this issue Nov 11, 2024 · 1 comment

Comments

@barkanido
Copy link

Hey and thanks for this great repo!

I am looking for some directions on how to implement IntoIterator for TicketStore.

from the test it looks like the returned iterator is expected to yield on a Ticket but the 'natural' iterator supplied by BTreeMap yields both the key and the value as documented here.

This confuses me:

  1. what would be the associated types of the returned iterator?
  2. can this be done without collecting (memory allocation) into a Vec first, for example, using a .map(|_, t| t). in that case, what should be the associated IntoIter type?
@LukeMathWalker
Copy link
Collaborator

It can—you have different methods on BTreeMap returning different kinds of iterators.
Look at the solution branch if you're still in doubt!

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

No branches or pull requests

2 participants