aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/prelude.rs
diff options
context:
space:
mode:
authorGravatar Wedson Almeida Filho <walmeida@microsoft.com> 2024-03-27 22:35:55 -0300
committerGravatar Miguel Ojeda <ojeda@kernel.org> 2024-04-16 22:03:14 +0200
commit03989773a94490383b062912feb0c4d175f20845 (patch)
tree14df87b69f4c7820ebe8802761496594feae13f0 /rust/kernel/prelude.rs
parentrust: kernel: move `allocator` module under `alloc` (diff)
downloadlinux-03989773a94490383b062912feb0c4d175f20845.tar.gz
linux-03989773a94490383b062912feb0c4d175f20845.tar.bz2
linux-03989773a94490383b062912feb0c4d175f20845.zip
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>
Diffstat (limited to 'rust/kernel/prelude.rs')
-rw-r--r--rust/kernel/prelude.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index ae21600970b3..c85b5972c0d3 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -14,6 +14,8 @@
#[doc(no_inline)]
pub use core::pin::Pin;
+pub use crate::alloc::vec_ext::VecExt;
+
#[doc(no_inline)]
pub use alloc::{boxed::Box, vec::Vec};