rust: alloc: introduce the `VecExt` trait
authorWedson Almeida Filho <walmeida@microsoft.com>
Thu, 28 Mar 2024 01:35:55 +0000 (22:35 -0300)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 16 Apr 2024 20:03:14 +0000 (22:03 +0200)
commit03989773a94490383b062912feb0c4d175f20845
tree14df87b69f4c7820ebe8802761496594feae13f0
parent31d94d8f586df55e7dce47a67a8428f46d09f906
rust: alloc: introduce the `VecExt` trait

Make `try_with_capacity`, `try_push`, and `try_extend_from_slice`
methods available in `Vec` even though it doesn't implement them. It is
implemented with `try_reserve` and `push_within_capacity`.

This is in preparation for switching to the upstream `alloc` crate.

Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
Link: https://lore.kernel.org/r/20240328013603.206764-3-wedsonaf@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc.rs
rust/kernel/alloc/vec_ext.rs [new file with mode: 0644]
rust/kernel/lib.rs
rust/kernel/prelude.rs