Clone

The Clone trait means that it is possible to make an explicit copy of a data value. The compiler won't ever do it automatically, but when we want to copy a value, we can do so by calling its Clone function.

Deriving the Clone trait looks like this:

#[derive(Clone)]
pub enum CloneExample {
Good,
Bad,
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.186.83