collections::slice::SliceConcatExt

Trait collections::slice::SliceConcatExt

pub trait SliceConcatExt<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

An extension trait for concatenating slices

Associated Types

???? This is a nightly-only experimental API. (slice_concat_ext #27747)trait should not have to exist

The resulting type after concatenation

Required Methods

Flattens a slice of T into a single value Self::Output.

Examples

assert_eq!(["hello", "world"].concat(), "helloworld");

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

Examples

assert_eq!(["hello", "world"].join(" "), "hello world");

Deprecated since 1.3.0: renamed to join

Implementors

  • impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V]
  • impl<S: Borrow<str>> SliceConcatExt<str> for [S]

© 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/collections/slice/trait.SliceConcatExt.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部