Skip to content

Commit acd044c

Browse files
committed
Rollup merge of rust-lang#21484 - steveklabnik:connect_docs, r=alexcrichton
2 parents aa874ab + 22d2387 commit acd044c

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/libcollections/slice.rs

+21-2
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,30 @@ impl<T> SliceExt for [T] {
967967
/// An extension trait for concatenating slices
968968
pub trait SliceConcatExt<T: ?Sized, U> {
969969
/// 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+
/// ```
970980
#[stable]
971981
fn concat(&self) -> U;
972982

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+
/// ```
975994
#[stable]
976995
fn connect(&self, sep: &T) -> U;
977996
}

0 commit comments

Comments
 (0)