pub trait CloneUnsized {
    // Required method
    fn unsized_clone_from(&mut self, source: &Self);
}
Expand description

Generalization of Clone which supports dynamically-sized or otherwise unsized types.

Implemented for:

  • Normal sized T which implements Clone.
  • the dynamicaly-sized slice type [T], as long as T itself implements Clone.
  • the tynamically-sized string slice type str.

This trait could easily be implemented for any other dynamically-sized type as well.

Required Methods§

source

fn unsized_clone_from(&mut self, source: &Self)

Mutates self to become a clone of source.

Signature purposefully matches Clone::clone_from and std::slice::clone_from_slice().

Implementations on Foreign Types§

source§

impl CloneUnsized for str

source§

fn unsized_clone_from(&mut self, source: &Self)

source§

impl<T> CloneUnsized for [T]where T: Clone,

source§

fn unsized_clone_from(&mut self, source: &Self)

Implementors§

source§

impl<T: Clone> CloneUnsized for T

Blanket implementation for any sized T that uses the normal Clone.