pub trait SliceConcatExt<T> where T: ?Sized { type Output; fn concat(&self) -> Self::Output; fn join(&self, sep: &T) -> Self::Output; fn connect(&self, sep: &T) -> Self::Output; }
An extension trait for concatenating slices
type Output
The resulting type after concatenation
fn concat(&self) -> Self::Output
Flattens a slice of T
into a single value Self::Output
.
assert_eq!(["hello", "world"].concat(), "helloworld");
fn join(&self, sep: &T) -> Self::Output
Flattens a slice of T
into a single value Self::Output
, placing a given separator between each.
assert_eq!(["hello", "world"].join(" "), "hello world");
fn connect(&self, sep: &T) -> Self::Output
impl<T, V> SliceConcatExt<T> for [V] where T: Clone, V: Borrow<[T]>
impl<S> SliceConcatExt<str> for [S] where S: Borrow<str>
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/slice/trait.SliceConcatExt.html