rust: alloc: update VecExt to take allocation flags
We also rename the methods by removing the `try_` prefix since the names are available due to our usage of the `no_global_oom_handling` config when building the `alloc` crate. Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20240328013603.206764-8-wedsonaf@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
committed by
Miguel Ojeda
parent
08d3f54928
commit
5ab560ce12
+1
-10
@@ -6,10 +6,7 @@
|
||||
|
||||
use crate::str::CStr;
|
||||
|
||||
use alloc::{
|
||||
alloc::{AllocError, LayoutError},
|
||||
collections::TryReserveError,
|
||||
};
|
||||
use alloc::alloc::{AllocError, LayoutError};
|
||||
|
||||
use core::convert::From;
|
||||
use core::fmt;
|
||||
@@ -192,12 +189,6 @@ impl From<Utf8Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TryReserveError> for Error {
|
||||
fn from(_: TryReserveError) -> Error {
|
||||
code::ENOMEM
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LayoutError> for Error {
|
||||
fn from(_: LayoutError) -> Error {
|
||||
code::ENOMEM
|
||||
|
||||
Reference in New Issue
Block a user