rust: alloc: add `Vec::dec_len`
authorTamir Duberstein <tamird@gmail.com>
Wed, 16 Apr 2025 17:15:41 +0000 (13:15 -0400)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 23 Apr 2025 10:05:22 +0000 (12:05 +0200)
commitdbb0b840a0cd2ebabbc94a0040e366c7f1a70f7b
treed050a015a1107b8e917e37e51cacea5abac5c173
parent47a17a63f9e23f7e8f39d0965bcda8fee6c322f8
rust: alloc: add `Vec::dec_len`

Add `Vec::dec_len` that reduces the length of the receiver. This method
is intended to be used from methods that remove elements from `Vec` such
as `truncate`, `pop`, `remove`, and others. This method is intentionally
not `pub`.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250416-vec-set-len-v4-2-112b222604cd@gmail.com
[ Add #[expect(unused)] to dec_len(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/alloc/kvec.rs