v0.4.0

Cloneable interfacev0.1.0

Source
A type whose values can be duplicated by calling Clone: the bound generic code writes before it duplicates an owning value of its type parameter.

A type whose values can be duplicated by calling Clone: the bound generic code writes before it duplicates an owning value of its type parameter.

pub interface Cloneable {
    func Clone(&self) -> Self;
}

A clone is independent of its source: each owns what it holds and releases it on its own, and changing one never changes the other. A handle that shares one value, such as Rc, clones by adding another owner of that value.

Requirements

Clone

func Clone(&self) -> Self

An independent duplicate of this value. Borrows the source and leaves it unchanged. An implementation that allocates terminates the program when its allocation fails, because the duplicate it promises cannot be made.

Returns: a value equal to this one that owns its own resources

Source