2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/kernel/alloc
Alexandre Courbot f86c0036c7 rust: alloc: implement Borrow and BorrowMut for KBox
Implement `Borrow<T>` and `BorrowMut<T>` for `KBox<T>`. This allows
`KBox<T>` to be used in generic APIs asking for types implementing those
traits. `T` and `&mut T` also implement those traits allowing users to
use either owned, borrowed and heap-owned values.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://lore.kernel.org/r/20250616-borrow_impls-v4-3-36f9beb3fe6a@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2025-06-18 23:09:41 +02:00
..
kvec rust: alloc: add Vec::insert_within_capacity 2025-05-07 18:40:45 +02:00
allocator_test.rs rust: alloc: add missing Markdown code span 2025-05-25 22:58:35 +02:00
allocator.rs rust: alloc: make ReallocFunc::call inline 2025-03-06 20:49:06 +01:00
kbox.rs rust: alloc: implement Borrow and BorrowMut for KBox 2025-06-18 23:09:41 +02:00
kvec.rs rust: alloc: implement Borrow and BorrowMut for Vec 2025-06-18 23:09:21 +02:00
layout.rs rust: alloc: add doctest for ArrayLayout::new() 2025-01-13 23:45:30 +01:00