Commit c226168b authored by mattgilbride@google.com's avatar mattgilbride@google.com Committed by Treehugger Robot
Browse files

FROMLIST: rust: rbtree: add `RBTreeCursor`

Add a cursor interface to `RBTree`, supporting the following use cases:
- Inspect the current node pointed to by the cursor, inspect/move to
  it's neighbors in sort order (bidirectionally).
- Mutate the tree itself by removing the current node pointed to by the
  cursor, or one of its neighbors.

Add functions to obtain a cursor to the tree by key:
- The node with the smallest key
- The node with the largest key
- The node matching the given key, or the one with the next larger key

The cursor abstraction is needed by the binder driver to efficiently
search for nodes and (conditionally) modify them, as well as their
neighbors [1].

Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-6-08ba9197f637@google.com/

 [1]
Co-developed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarMatt Gilbride <mattgilbride@google.com>

Bug: 324206405
Link: https://lore.kernel.org/all/20240205-b4-rbtree-v1-5-995e3eee38c0@google.com/


Change-Id: I95b683dab428c2c8e3083899f62f70d140c51e76
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent a3e1a106
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment