ImplicitClone

Trait ImplicitClone 

Source
pub trait ImplicitClone: Clone {
    // Provided method
    fn implicit_clone(&self) -> Self { ... }
}
Expand description

Marker trait for cheap-to-clone types that should be allowed to be cloned implicitly.

Enables host libraries to have the same syntax as Copy while calling the Clone implementation instead.

Provided Methodsยง

Source

fn implicit_clone(&self) -> Self

This function is not magic; it is literally defined as

โ“˜
fn implicit_clone(&self) -> Self {
    self.clone()
}

It is useful when you want to clone but also ensure that the type implements ImplicitClone.

Examples:

use implicit_clone::ImplicitClone;
let x: u32 = Default::default();
let clone = ImplicitClone::implicit_clone(&x);
โ“˜
use implicit_clone::ImplicitClone;
let x: Vec<u32> = Default::default();
// does not compile because Vec<_> does not implement ImplicitClone
let clone = ImplicitClone::implicit_clone(&x);

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 ImplicitClone for bool

Sourceยง

impl ImplicitClone for char

Sourceยง

impl ImplicitClone for f32

Sourceยง

impl ImplicitClone for f64

Sourceยง

impl ImplicitClone for i8

Sourceยง

impl ImplicitClone for i16

Sourceยง

impl ImplicitClone for i32

Sourceยง

impl ImplicitClone for i64

Sourceยง

impl ImplicitClone for i128

Sourceยง

impl ImplicitClone for isize

Sourceยง

impl ImplicitClone for u8

Sourceยง

impl ImplicitClone for u16

Sourceยง

impl ImplicitClone for u32

Sourceยง

impl ImplicitClone for u64

Sourceยง

impl ImplicitClone for u128

Sourceยง

impl ImplicitClone for ()

Sourceยง

impl ImplicitClone for usize

Sourceยง

impl ImplicitClone for StyleManager

Sourceยง

impl ImplicitClone for Key

Sourceยง

impl<T1> ImplicitClone for (T1,)
where T1: ImplicitClone,

Sourceยง

impl<T1, T2> ImplicitClone for (T1, T2)

Sourceยง

impl<T1, T2, T3> ImplicitClone for (T1, T2, T3)

Sourceยง

impl<T1, T2, T3, T4> ImplicitClone for (T1, T2, T3, T4)

Sourceยง

impl<T1, T2, T3, T4, T5> ImplicitClone for (T1, T2, T3, T4, T5)

Sourceยง

impl<T1, T2, T3, T4, T5, T6> ImplicitClone for (T1, T2, T3, T4, T5, T6)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7, T8> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7, T8)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7, T8, T9)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Sourceยง

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> ImplicitClone for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Sourceยง

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

Sourceยง

impl<T> ImplicitClone for &T
where T: ?Sized,

Sourceยง

impl<T> ImplicitClone for Rc<T>
where T: ?Sized,

Sourceยง

impl<T> ImplicitClone for Arc<T>
where T: ?Sized,

Sourceยง

impl<const N: usize, T> ImplicitClone for [T; N]
where T: ImplicitClone,

Implementorsยง

Sourceยง

impl ImplicitClone for implicit_clone::sync::string::IString

Sourceยง

impl ImplicitClone for implicit_clone::unsync::string::IString

Sourceยง

impl ImplicitClone for Classes

Sourceยง

impl ImplicitClone for NodeRef

Sourceยง

impl<Comp> ImplicitClone for Scope<Comp>
where Comp: Component,

Sourceยง

impl<IN, OUT> ImplicitClone for Callback<IN, OUT>

Sourceยง

impl<K, V> ImplicitClone for implicit_clone::sync::map::IMap<K, V>
where K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static,

Sourceยง

impl<K, V> ImplicitClone for implicit_clone::unsync::map::IMap<K, V>
where K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static,

Sourceยง

impl<T> ImplicitClone for implicit_clone::sync::array::IArray<T>
where T: ImplicitClone + 'static,

Sourceยง

impl<T> ImplicitClone for implicit_clone::unsync::array::IArray<T>
where T: ImplicitClone + 'static,