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 @@ -967,11 +967,30 @@ impl<T> SliceExt for [T] {
967
967
/// An extension trait for concatenating slices
968
968
pub trait SliceConcatExt < T : ?Sized , U > {
969
969
/// Flattens a slice of `T` into a single value `U`.
970
+ ///
971
+ /// # Examples
972
+ ///
973
+ /// ```
974
+ /// let v = vec!["hello", "world"];
975
+ ///
976
+ /// let s: String = v.concat();
977
+ ///
978
+ /// println!("{}", s); // prints "helloworld"
979
+ /// ```
970
980
#[ stable]
971
981
fn concat ( & self ) -> U ;
972
982
973
- /// Flattens a slice of `T` into a single value `U`, placing a
974
- /// given separator between each.
983
+ /// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
984
+ ///
985
+ /// # Examples
986
+ ///
987
+ /// ```
988
+ /// let v = vec!["hello", "world"];
989
+ ///
990
+ /// let s: String = v.connect(" ");
991
+ ///
992
+ /// println!("{}", s); // prints "hello world"
993
+ /// ```
975
994
#[ stable]
976
995
fn connect ( & self , sep : & T ) -> U ;
977
996
}
You can’t perform that action at this time.
0 commit comments