diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 0e92676cf97..6ca0db68a88 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -49,6 +49,18 @@ pub trait ToOwned { type Owned: Borrow; /// 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; }