Skip to content

Commit

Permalink
An example for clone
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Mar 24, 2015
1 parent 28a0b25 commit 4065246
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libcore/clone.rs
Expand Up @@ -27,6 +27,14 @@ use marker::Sized;
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Clone : Sized {
/// Returns a copy of the value.
///
/// # Examples
///
/// ```
/// let hello = "Hello"; // &str implements Clone
///
/// assert_eq!("Hello", hello.clone());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn clone(&self) -> Self;

Expand Down

0 comments on commit 4065246

Please sign in to comment.