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

Tracking issue for extra linked list methods #27794

Open
alexcrichton opened this Issue Aug 13, 2015 · 5 comments

Comments

Projects
None yet
6 participants
@alexcrichton
Member

alexcrichton commented Aug 13, 2015

This is a tracking issue for the unstable linked_list_extras methods in the standard library.

cc @Gankro, perhaps you can fill this in some more? The specific methods in question are:

  • IterMut::insert_next
  • IterMut::peek_next
@Gankro

This comment has been minimized.

Contributor

Gankro commented Aug 13, 2015

This is basically a lame version of cursors, which is what we should use instead imo. It's not 1:1 though -- this api lets you have all the elements yielded at once. Classic iterator tradeoff.

@steveklabnik

This comment has been minimized.

Member

steveklabnik commented Nov 30, 2016

Triage: these are still unstable.

@dtolnay

This comment has been minimized.

Member

dtolnay commented Nov 16, 2017

There are some ideas for a more complete IterMut API in #39148 (comment).

@dtolnay

This comment has been minimized.

Member

dtolnay commented Nov 16, 2017

IterMut::peek_next seems misnamed. Doesn't it do exactly what we call peek() elsewhere?

@Amanieu

This comment has been minimized.

Contributor

Amanieu commented Nov 16, 2017

I'm going to echo @Gankro's thoughts:

This is basically a lame version of cursors, which is what we should use instead imo.

An iterator conceptually represents a (double-ended) range of elements. The only operation that it supports is popping an element off the end of that range.

A cursor on the other hand represents a position in a collection, and can be moved backwards or forwards in the collection. The cursor can be used to insert or remove an element at any given position in the collection.

I strongly oppose adding insertion/deleting methods to IterMut since they do not fit at all with existing iterator usage patterns (for loops and functional-style methods).

As I mentioned in the linked thread, a design based on the Cursor and CursotMut types in intrusive-collections could be used.

@Amanieu Amanieu referenced this issue Oct 24, 2018

Open

RFC: Linked list cursors #2570

0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment