Trait collections::slice::SliceConcatExtUnstable
[-] [+]
[src]
pub trait SliceConcatExt<T: ?Sized, U> { fn concat(&self) -> U; fn connect(&self, sep: &T) -> U; }
An extension trait for concatenating slices
Required Methods
fn concat(&self) -> U
Flattens a slice of T
into a single value U
.
Examples
fn main() { let v = vec!["hello", "world"]; let s: String = v.concat(); println!("{}", s); // prints "helloworld" }let v = vec!["hello", "world"]; let s: String = v.concat(); println!("{}", s); // prints "helloworld"
fn connect(&self, sep: &T) -> U
Flattens a slice of T
into a single value U
, placing a given separator between each.
Examples
fn main() { let v = vec!["hello", "world"]; let s: String = v.connect(" "); println!("{}", s); // prints "hello world" }let v = vec!["hello", "world"]; let s: String = v.connect(" "); println!("{}", s); // prints "hello world"