We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TryClone::clone_panic_on_oom
1 parent 25e3bd1 commit e6948e7Copy full SHA for e6948e7
1 file changed
crates/core/src/alloc/try_clone.rs
@@ -8,6 +8,12 @@ pub trait TryClone: Sized {
8
/// Attempt to clone `self`, returning an error if any allocation fails
9
/// during cloning.
10
fn try_clone(&self) -> Result<Self, OutOfMemory>;
11
+
12
+ /// Clone `self`, panicking on allocation failure.
13
+ fn clone_panic_on_oom(&self) -> Self {
14
+ use super::PanicOnOom as _;
15
+ self.try_clone().panic_on_oom()
16
+ }
17
}
18
19
impl<T> TryClone for *mut T
0 commit comments