Skip to content

Commit

Permalink
add doc examples for connect/concat
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Jan 21, 2015
1 parent 6869645 commit 22d2387
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/libcollections/slice.rs
Expand Up @@ -993,11 +993,30 @@ impl<T> SliceExt for [T] {
/// An extension trait for concatenating slices
pub trait SliceConcatExt<T: ?Sized, 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]
fn concat(&self) -> U;

/// Flattens a slice of `T` into a single value `U`, placing a
/// given separator between each.
/// Flattens a slice of `T` into a single value `U`, placing a given separator between each.
///
/// # Examples
///
/// ```
/// let v = vec!["hello", "world"];
///
/// let s: String = v.connect(" ");
///
/// println!("{}", s); // prints "hello world"
/// ```
#[stable]
fn connect(&self, sep: &T) -> U;
}
Expand Down

0 comments on commit 22d2387

Please sign in to comment.