File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 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] {
993993/// An extension trait for concatenating slices
994994pub trait SliceConcatExt < T : ?Sized , U > {
995995 /// 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+ /// ```
9961006 #[ stable]
9971007 fn concat ( & self ) -> U ;
9981008
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+ /// ```
10011020 #[ stable]
10021021 fn connect ( & self , sep : & T ) -> U ;
10031022}
You can’t perform that action at this time.
0 commit comments