Re: [PATCH 3/5] rust: alloc: add Vec::push_within_capacity
From: Benno Lossin
Date: Thu Mar 20 2025 - 18:17:37 EST
On Thu Mar 20, 2025 at 2:52 PM CET, Alice Ryhl wrote:
> This introduces a new method called `push_within_capacity` for appending
> to a vector without attempting to allocate if the capacity is full. Rust
> Binder will use this in various places to safely push to a vector while
> holding a spinlock.
>
> The existing Vec::push method is reimplemented in terms of the new
> method.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
Cheers,
Benno
> ---
> rust/kernel/alloc/kvec.rs | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)