This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on docs.rs.
yew::html

Trait ImplicitClone

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§

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§

§

impl ImplicitClone for bool

§

impl ImplicitClone for char

§

impl ImplicitClone for f32

§

impl ImplicitClone for f64

§

impl ImplicitClone for i8

§

impl ImplicitClone for i16

§

impl ImplicitClone for i32

§

impl ImplicitClone for i64

§

impl ImplicitClone for i128

§

impl ImplicitClone for isize

§

impl ImplicitClone for u8

§

impl ImplicitClone for u16

§

impl ImplicitClone for u32

§

impl ImplicitClone for u64

§

impl ImplicitClone for u128

§

impl ImplicitClone for ()

§

impl ImplicitClone for usize

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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)

§

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)

§

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

§

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

§

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

§

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

§

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

Implementors§

Source§

impl ImplicitClone for Listeners

Source§

impl ImplicitClone for VNode

Source§

impl ImplicitClone for Key

Source§

impl ImplicitClone for VList

Source§

impl ImplicitClone for VRaw

Source§

impl ImplicitClone for VSuspense

Source§

impl ImplicitClone for VTag

Source§

impl ImplicitClone for VText

Source§

impl ImplicitClone for Classes

Source§

impl ImplicitClone for NodeRef

§

impl ImplicitClone for IString

§

impl ImplicitClone for IString

Source§

impl<COMP: BaseComponent> ImplicitClone for VChild<COMP>

Source§

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

Source§

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

Source§

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

Source§

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

§

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

§

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

§

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

§

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