Skip to content

Commit

Permalink
Rollup merge of rust-lang#32744 - GuillaumeGomez:patch-3, r=steveklabnik
Browse files Browse the repository at this point in the history
Add example doc for ToOwned trait

Fixes rust-lang#29342.

r? @steveklabnik
  • Loading branch information
steveklabnik committed Apr 6, 2016
2 parents c1d45c7 + 6fee337 commit aca5a34
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ pub trait ToOwned {
type Owned: Borrow<Self>;

/// Creates owned data from borrowed data, usually by cloning.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let s = "a"; // &str
/// let ss = s.to_owned(); // String
///
/// let v = &[1, 2]; // slice
/// let vv = v.to_owned(); // Vec
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn to_owned(&self) -> Self::Owned;
}
Expand Down

0 comments on commit aca5a34

Please sign in to comment.