Cursor in std::collections::btree_map - Rust

pub struct Cursor<'a, K, V>

where K: 'a, V: 'a,

{ /* private fields */ }

๐Ÿ”ฌThis is a nightly-only experimental API. (btree_cursors #107540)

Expand description

A cursor over a BTreeMap.

A Cursor is like an iterator, except that it can freely seek back-and-forth.

Cursors always point to a gap between two elements in the map, and can operate on the two immediately adjacent elements.

A Cursor is created with the BTreeMap::lower_bound and BTreeMap::upper_bound methods.

Sourceยง
Source

๐Ÿ”ฌThis is a nightly-only experimental API. (btree_cursors #107540)

Advances the cursor to the next gap, returning the key and value of the element that it moved over.

If the cursor is already at the end of the map then None is returned and the cursor is not moved.

Source

๐Ÿ”ฌThis is a nightly-only experimental API. (btree_cursors #107540)

Advances the cursor to the previous gap, returning the key and value of the element that it moved over.

If the cursor is already at the start of the map then None is returned and the cursor is not moved.

Source

๐Ÿ”ฌThis is a nightly-only experimental API. (btree_cursors #107540)

Returns a reference to the key and value of the next element without moving the cursor.

If the cursor is at the end of the map then None is returned.

Source

๐Ÿ”ฌThis is a nightly-only experimental API. (btree_cursors #107540)

Returns a reference to the key and value of the previous element without moving the cursor.

If the cursor is at the start of the map then None is returned.