FROMGIT: rust: alloc: add Vec::drain_all
This is like the stdlib method drain, except that it's hard-coded to use the entire vector's range. Rust Binder uses it in the range allocator to take ownership of everything in a vector in a case where reusing the vector is desirable. Implementing `DrainAll` in terms of `slice::IterMut` lets us reuse some nice optimizations in core for the case where T is a ZST. Signed-off-by:Alice Ryhl <aliceryhl@google.com> Reviewed-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by:
Benno Lossin <lossin@kernel.org> Link: https://lore.kernel.org/r/20250502-vec-methods-v5-4-06d20ad9366f@google.com Signed-off-by:
Danilo Krummrich <dakr@kernel.org> Bug: 414994413 (cherry picked from commit 088bf14a https://github.com/Rust-for-Linux/linux.git alloc-next) Change-Id: I65ab0823980a15a0c18f960f9ab7ff6fa621c06a Signed-off-by:
Alice Ryhl <aliceryhl@google.com>
Loading
Please sign in to comment