Commit e1da6035 authored by Alice Ryhl's avatar Alice Ryhl Committed by Matthew Maurer
Browse files

FROMGIT: rust: alloc: add Vec::retain



This adds a common Vec method called `retain` that removes all elements
that don't match a certain condition. Rust Binder uses it to find all
processes that match a given pid.

The stdlib retain method takes &T rather than &mut T and has a separate
retain_mut for the &mut T case. However, this is considered an API
mistake that can't be fixed now due to backwards compatibility. There's
no reason for us to repeat that mistake.

Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarBenno Lossin <lossin@kernel.org>
Link: https://lore.kernel.org/r/20250502-vec-methods-v5-5-06d20ad9366f@google.com


Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>

Bug: 414994413
(cherry picked from commit 9f140894
 https://github.com/Rust-for-Linux/linux.git

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