Skip to content

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

@neuronsguy

Description

@neuronsguy

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions