about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-01-21 17:56:33 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-01-21 17:56:33 -0500
commit22d2387db2a9d3d471ae71378d928db2547111d9 (patch)
treed46e9b2f3cb593514bc8954b70685ea86dbad592
parent6869645e86c91544b8737b89809bdf10bef536d9 (diff)
downloadrust-22d2387db2a9d3d471ae71378d928db2547111d9.tar.gz
rust-22d2387db2a9d3d471ae71378d928db2547111d9.zip
add doc examples for connect/concat
-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 988ec4c661f..681173b4ce1 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -993,11 +993,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;
 }