Trait std::slice::SliceConcatExt [−][src]
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; }
🔬 This is a nightly-only experimental API. (slice_concat_ext #27747)
trait should not have to exist
スライスを結合するための拡張トレイト
このトレイトは不安定ですが、メソッドは安定しています。SliceConcatExtはstandard library preludeに含まれますので、[join]とconcat()を[T]自体に存在しているかのように使用することができます。
Associated Types
type Output
🔬 This is a nightly-only experimental API. (slice_concat_ext #27747)
trait should not have to exist
結合後に得られる型
Required Methods
fn concat(&self) -> Self::Output1.0.0
Tのスライスをフラットにして単独の値Self::Outputを得ます。
Flattens a slice of T into a single value Self::Output.
Examples
assert_eq!(["hello", "world"].concat(), "helloworld"); assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);Run
fn join(&self, sep: &T) -> Self::Output1.3.0
各要素の間に与えられたセパレータを置きながら、Tのスライスをフラットにして単独の値Self::Outputを得まmす。
Examples
assert_eq!(["hello", "world"].join(" "), "hello world"); assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);Run
fn connect(&self, sep: &T) -> Self::Output1.0.0
Deprecated since 1.3.0
: renamed to join