Skip to main content

TryClone

Trait TryClone 

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§

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

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

Provided Methods§

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§

§

impl TryClone for bool

§

impl TryClone for char

§

impl TryClone for f32

§

impl TryClone for f64

§

impl TryClone for i8

§

impl TryClone for i16

§

impl TryClone for i32

§

impl TryClone for i64

§

impl TryClone for i128

§

impl TryClone for isize

§

impl TryClone for u8

§

impl TryClone for u16

§

impl TryClone for u32

§

impl TryClone for u64

§

impl TryClone for u128

§

impl TryClone for ()

§

impl TryClone for usize

§

impl TryClone for DefaultHashBuilder

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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,

§

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,

§

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,

§

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,

§

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,

§

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

§

impl<T> TryClone for Arc<T>

§

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

Implementors§

Source§

impl TryClone for GcLayout

Source§

impl TryClone for WasmCompositeInnerType

Source§

impl TryClone for WasmValType

§

impl TryClone for Box<str>

Source§

impl TryClone for Atom

Source§

impl TryClone for DataIndex

Source§

impl TryClone for DefinedFuncIndex

Source§

impl TryClone for DefinedGlobalIndex

Source§

impl TryClone for DefinedMemoryIndex

Source§

impl TryClone for DefinedTableIndex

Source§

impl TryClone for DefinedTagIndex

Source§

impl TryClone for ElemIndex

Source§

impl TryClone for EngineInternedRecGroupIndex

Source§

impl TryClone for FuncIndex

Source§

impl TryClone for GcStructLayout

Source§

impl TryClone for GcStructLayoutField

Source§

impl TryClone for GlobalIndex

Source§

impl TryClone for MemoryIndex

Source§

impl TryClone for ModuleInternedRecGroupIndex

Source§

impl TryClone for ModuleInternedTypeIndex

Source§

impl TryClone for OwnedMemoryIndex

Source§

impl TryClone for RecGroupRelativeTypeIndex

Source§

impl TryClone for StaticModuleIndex

Source§

impl TryClone for StringPool

Source§

impl TryClone for TableIndex

Source§

impl TryClone for TagIndex

Source§

impl TryClone for TypeIndex

Source§

impl TryClone for VMSharedTypeIndex

Source§

impl TryClone for WasmCompositeType

Source§

impl TryClone for WasmExnType

Source§

impl TryClone for WasmFieldType

Source§

impl TryClone for WasmFuncType

Source§

impl TryClone for WasmStructType

Source§

impl TryClone for WasmSubType

§

impl TryClone for RandomState

§

impl TryClone for String

§

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

Source§

impl<K, V, S> TryClone for HashMap<K, V, S>
where K: Eq + Hash + TryClone, V: TryClone, S: BuildHasher + TryClone,

Source§

impl<K, V, S> TryClone for IndexMap<K, V, S>
where K: Eq + Hash + TryClone, V: TryClone, S: BuildHasher + TryClone,

§

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

§

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

§

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

§

impl<T> TryClone for PackedOption<T>

§

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

§

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

§

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

§

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