Skip to main content

TryClone

Trait TryClone 

Source
pub trait TryClone: Sized {
    // Required method
    fn try_clone(&self) -> Result<Self, OutOfMemory>;

    // Provided method
    fn clone_panic_on_oom(&self) -> Self { ... }
}
Expand description

A trait for values that can be cloned, but contain owned, heap-allocated values whose allocations may fail during cloning.

Required Methods§

Source

fn try_clone(&self) -> Result<Self, OutOfMemory>

Attempt to clone self, returning an error if any allocation fails during cloning.

Provided Methods§

Source

fn clone_panic_on_oom(&self) -> Self

Clone self, panicking on allocation failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryClone for bool

Source§

impl TryClone for char

Source§

impl TryClone for f32

Source§

impl TryClone for f64

Source§

impl TryClone for i8

Source§

impl TryClone for i16

Source§

impl TryClone for i32

Source§

impl TryClone for i64

Source§

impl TryClone for i128

Source§

impl TryClone for isize

Source§

impl TryClone for u8

Source§

impl TryClone for u16

Source§

impl TryClone for u32

Source§

impl TryClone for u64

Source§

impl TryClone for u128

Source§

impl TryClone for ()

Source§

impl TryClone for usize

Source§

impl TryClone for Box<str>

Source§

impl TryClone for DefaultHashBuilder

Source§

impl<'a, T> TryClone for &'a T
where T: ?Sized,

Source§

impl<A> TryClone for (A,)
where A: TryClone,

Source§

impl<A, B> TryClone for (A, B)
where A: TryClone, B: TryClone,

Source§

impl<A, B, C> TryClone for (A, B, C)
where A: TryClone, B: TryClone, C: TryClone,

Source§

impl<A, B, C, D> TryClone for (A, B, C, D)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone,

Source§

impl<A, B, C, D, E> TryClone for (A, B, C, D, E)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone,

Source§

impl<A, B, C, D, E, F> TryClone for (A, B, C, D, E, F)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone, F: TryClone,

Source§

impl<A, B, C, D, E, F, G> TryClone for (A, B, C, D, E, F, G)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone, F: TryClone, G: TryClone,

Source§

impl<A, B, C, D, E, F, G, H> TryClone for (A, B, C, D, E, F, G, H)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone, F: TryClone, G: TryClone, H: TryClone,

Source§

impl<A, B, C, D, E, F, G, H, I> TryClone for (A, B, C, D, E, F, G, H, I)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone, F: TryClone, G: TryClone, H: TryClone, I: TryClone,

Source§

impl<A, B, C, D, E, F, G, H, I, J> TryClone for (A, B, C, D, E, F, G, H, I, J)
where A: TryClone, B: TryClone, C: TryClone, D: TryClone, E: TryClone, F: TryClone, G: TryClone, H: TryClone, I: TryClone, J: TryClone,

Source§

impl<T> TryClone for Option<T>
where T: TryClone,

Source§

impl<T> TryClone for *mut T
where T: ?Sized,

Source§

impl<T> TryClone for Box<[T]>
where T: TryClone,

Source§

impl<T> TryClone for Box<T>
where T: TryClone,

Source§

impl<T> TryClone for Arc<T>

Source§

impl<T> TryClone for ManuallyDrop<T>
where T: TryClone,

Source§

impl<T> TryClone for NonNull<T>
where T: ?Sized,

Source§

impl<T, E> TryClone for Result<T, E>
where T: TryClone, E: TryClone,

Implementors§

Source§

impl TryClone for TryString

Source§

impl<B> TryClone for TryCow<'_, B>
where B: ?Sized + TryToOwned,

Source§

impl<T> TryClone for TryVec<T>
where T: TryClone,