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

Lifetime of elements returned by Cursor::peek_next etc. #13

Open
neuronsguy opened this issue Feb 16, 2017 · 0 comments
Open

Lifetime of elements returned by Cursor::peek_next etc. #13

neuronsguy opened this issue Feb 16, 2017 · 0 comments

Comments

@neuronsguy
Copy link

Hi,

At the moment it seems that

Cursor::next()
Cursor::prev()
Cursor::peek_next()
Cursor::peek_prev()

all return Option<&mut T> where the reference has the lifetime of the Cursor instance, and not the underlying LinkedList.

I believe it should be safe in those methods to update the signatures to .. -> Option<&'a mut T>, and transmute the return value to have the appropriate lifetime. Does that sound correct?

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

1 participant