about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-17 08:35:13 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-17 11:50:29 -0800
commitcada943f145cf85d2b01b9046dde8ff599670b80 (patch)
tree431d9ea606e6236b70c82940b0b318e99135ef00
parent1f2a18c7a6faee78d2770f9ada774f3bda277d29 (diff)
parenta9dbb7908dd851dff81f613452518db3ba04887c (diff)
downloadrust-cada943f145cf85d2b01b9046dde8ff599670b80.tar.gz
rust-cada943f145cf85d2b01b9046dde8ff599670b80.zip
rollup merge of #19895: jbranchaud/add-string-add-doctest
-rw-r--r--src/libcollections/string.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index bc179cb37fb..062946652be 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -859,6 +859,16 @@ impl<'a, S: Str> Equiv<S> for String {
 #[cfg(stage0)]
 #[experimental = "waiting on Add stabilization"]
 impl<S: Str> Add<S, String> for String {
+    /// Concatenates `self` and `other` as a new mutable `String`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let string1 = "foo".to_string();
+    /// let string2 = "bar".to_string();
+    /// let string3 = string1 + string2;
+    /// assert_eq!(string3, "foobar".to_string());
+    /// ```
     fn add(&self, other: &S) -> String {
         let mut s = String::from_str(self.as_slice());
         s.push_str(other.as_slice());