Skip to content
Snippets Groups Projects
Commit 08d3f549 authored by Wedson Almeida Filho's avatar Wedson Almeida Filho Committed by Miguel Ojeda
Browse files

rust: alloc: introduce the `BoxExt` trait


Make fallible versions of `new` and `new_uninit` methods available in
`Box` even though it doesn't implement them because we build `alloc`
with the `no_global_oom_handling` config.

They also have an extra `flags` parameter that allows callers to pass
flags to the allocator.

Signed-off-by: default avatarWedson Almeida Filho <walmeida@microsoft.com>
Reviewed-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Reviewed-by: default avatarBenno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20240328013603.206764-7-wedsonaf@gmail.com


[ Used `Box::write()` to avoid one `unsafe` block as suggested by Boqun. ]
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent b6a006e2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment