diff options
author | Alice Ryhl <aliceryhl@google.com> | 2025-05-02 13:19:32 +0000 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-05-07 18:39:22 +0200 |
commit | 088bf14a886e1e746c961a862ebccbb76d7cbd4e (patch) | |
tree | 4d3bc92e782cc77eb92f52d43a9247c0b0e2b3de /scripts/generate_rust_analyzer.py | |
parent | 9def0d0a2a1c62d7970f4ce5ad5557968c98f637 (diff) |
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>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions