diff options
| author | Alice Ryhl <[email protected]> | 2025-06-16 10:36:21 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2025-06-29 16:52:41 +0000 |
| commit | fbcd4b7bf5c92f7d456eefcecac518023357cea4 (patch) | |
| tree | 412e7a16837627164159f907fa6d3ab445f7133f /rust/pin-init/examples/static_init.rs | |
| parent | rust: io: avoid mentioning private fields in `IoMem` (diff) | |
| download | kernel-fbcd4b7bf5c92f7d456eefcecac518023357cea4.tar.gz kernel-fbcd4b7bf5c92f7d456eefcecac518023357cea4.zip | |
rust: rbtree: add RBTree::is_empty
In Rust Binder I need to be able to determine whether a red/black tree
is empty. Thus, add a method for that operation to replace
rbtree.iter().next().is_none()
This is terrible, so add a method for this purpose. We do not add a
RBTree::len method because computing the number of elements requires
iterating the entire tree, but checking whether it is empty can be done
cheaply.
Signed-off-by: Alice Ryhl <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Adjusted title. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/pin-init/examples/static_init.rs')
0 files changed, 0 insertions, 0 deletions
