Rollup merge of #21484 - steveklabnik:connect_docs, r=alexcrichton
This commit is contained in:
commit
acd044c255
1 changed files with 21 additions and 2 deletions
|
@ -967,11 +967,30 @@ impl<T> SliceExt for [T] {
|
||||||
/// An extension trait for concatenating slices
|
/// An extension trait for concatenating slices
|
||||||
pub trait SliceConcatExt<T: ?Sized, U> {
|
pub trait SliceConcatExt<T: ?Sized, U> {
|
||||||
/// Flattens a slice of `T` into a single value `U`.
|
/// Flattens a slice of `T` into a single value `U`.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let v = vec!["hello", "world"];
|
||||||
|
///
|
||||||
|
/// let s: String = v.concat();
|
||||||
|
///
|
||||||
|
/// println!("{}", s); // prints "helloworld"
|
||||||
|
/// ```
|
||||||
#[stable]
|
#[stable]
|
||||||
fn concat(&self) -> U;
|
fn concat(&self) -> U;
|
||||||
|
|
||||||
/// Flattens a slice of `T` into a single value `U`, placing a
|
/// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
|
||||||
/// given separator between each.
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let v = vec!["hello", "world"];
|
||||||
|
///
|
||||||
|
/// let s: String = v.connect(" ");
|
||||||
|
///
|
||||||
|
/// println!("{}", s); // prints "hello world"
|
||||||
|
/// ```
|
||||||
#[stable]
|
#[stable]
|
||||||
fn connect(&self, sep: &T) -> U;
|
fn connect(&self, sep: &T) -> U;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue