diff options
| author | Alice Ryhl <[email protected]> | 2024-08-22 16:37:57 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2024-08-31 15:36:20 +0000 |
| commit | a335e95914046c6bed45c0d17cabcd483682cf5e (patch) | |
| tree | e2454458acbe0a4e5e6e5c1d83e14b17721d4ed9 /scripts/generate_rust_target.rs | |
| parent | rust: rbtree: add cursor (diff) | |
| download | kernel-a335e95914046c6bed45c0d17cabcd483682cf5e.tar.gz kernel-a335e95914046c6bed45c0d17cabcd483682cf5e.zip | |
rust: rbtree: add `RBTree::entry`
This mirrors the entry API [1] from the Rust standard library on
`RBTree`. This API can be used to access the entry at a specific key and
make modifications depending on whether the key is vacant or occupied.
This API is useful because it can often be used to avoid traversing the
tree multiple times.
This is used by binder to look up and conditionally access or insert a
value, depending on whether it is there or not [2].
Link: https://doc.rust-lang.org/stable/std/collections/btree_map/enum.Entry.html [1]
Link: https://android-review.googlesource.com/c/kernel/common/+/2849906 [2]
Signed-off-by: Alice Ryhl <[email protected]>
Tested-by: Alice Ryhl <[email protected]>
Reviewed-by: Boqun Feng <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Signed-off-by: Matt Gilbride <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'scripts/generate_rust_target.rs')
0 files changed, 0 insertions, 0 deletions
