Skip to content

Lifetime of returned next references #2

@tommie

Description

@tommie

I'm interested in bplustree, because it seems to allow removal/insertion without invalidating iterators, something it seems BTreeMap cannot do without cursors, which are only in nightly.

However, I'm hitting a lifetime issue with RawExclusiveIter::next:

pub fn next(&mut self) -> Option<(&K, &V)> {

The associated type in btree_map::Iter uses the container's lifetime:

type Item = (&'a K, &'a V)

which suggests the returned references should be tagged with 't in bplustree, since the underlying data should be valid even as the iterator is dropped.

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