File tree 1 file changed +21
-2
lines changed
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -993,11 +993,30 @@ impl<T> SliceExt for [T] {
993
993
/// An extension trait for concatenating slices
994
994
pub trait SliceConcatExt < T : ?Sized , U > {
995
995
/// Flattens a slice of `T` into a single value `U`.
996
+ ///
997
+ /// # Examples
998
+ ///
999
+ /// ```
1000
+ /// let v = vec!["hello", "world"];
1001
+ ///
1002
+ /// let s: String = v.concat();
1003
+ ///
1004
+ /// println!("{}", s); // prints "helloworld"
1005
+ /// ```
996
1006
#[ stable]
997
1007
fn concat ( & self ) -> U ;
998
1008
999
- /// Flattens a slice of `T` into a single value `U`, placing a
1000
- /// given separator between each.
1009
+ /// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
1010
+ ///
1011
+ /// # Examples
1012
+ ///
1013
+ /// ```
1014
+ /// let v = vec!["hello", "world"];
1015
+ ///
1016
+ /// let s: String = v.connect(" ");
1017
+ ///
1018
+ /// println!("{}", s); // prints "hello world"
1019
+ /// ```
1001
1020
#[ stable]
1002
1021
fn connect ( & self , sep : & T ) -> U ;
1003
1022
}
You can’t perform that action at this time.
0 commit comments