Skip to content

Commit 4065246

Browse files
committed
An example for clone
1 parent 28a0b25 commit 4065246

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libcore/clone.rs

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ use marker::Sized;
2727
#[stable(feature = "rust1", since = "1.0.0")]
2828
pub trait Clone : Sized {
2929
/// Returns a copy of the value.
30+
///
31+
/// # Examples
32+
///
33+
/// ```
34+
/// let hello = "Hello"; // &str implements Clone
35+
///
36+
/// assert_eq!("Hello", hello.clone());
37+
/// ```
3038
#[stable(feature = "rust1", since = "1.0.0")]
3139
fn clone(&self) -> Self;
3240

0 commit comments

Comments
 (0)