about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-01-22 18:10:00 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-01-22 18:10:00 -0500
commitacd044c2555e2a0d014569a59f72c595a2ec03b5 (patch)
tree7238e16a3420af29259d697d6ccd68516d38c98c /src
parentaa874abc0dab50b5f315778761e1c090f461a2e9 (diff)
parent22d2387db2a9d3d471ae71378d928db2547111d9 (diff)
downloadrust-acd044c2555e2a0d014569a59f72c595a2ec03b5.tar.gz
rust-acd044c2555e2a0d014569a59f72c595a2ec03b5.zip
Rollup merge of #21484 - steveklabnik:connect_docs, r=alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/slice.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 8c7f79d4d78..f65802de5ac 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -967,11 +967,30 @@ impl<T> SliceExt for [T] {
 /// An extension trait for concatenating slices
 pub trait SliceConcatExt<T: ?Sized, U> {
     /// Flattens a slice of `T` into a single value `U`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = vec!["hello", "world"];
+    ///
+    /// let s: String = v.concat();
+    ///
+    /// println!("{}", s); // prints "helloworld"
+    /// ```
     #[stable]
     fn concat(&self) -> U;
 
-    /// Flattens a slice of `T` into a single value `U`, placing a
-    /// given separator between each.
+    /// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let v = vec!["hello", "world"];
+    ///
+    /// let s: String = v.connect(" ");
+    ///
+    /// println!("{}", s); // prints "hello world"
+    /// ```
     #[stable]
     fn connect(&self, sep: &T) -> U;
 }