std::slice::SliceConcatExt - Rust
Description: API documentation for the Rust `SliceConcatExt` trait in crate `std`.
Keywords: rust, rustlang, rust-lang, SliceConcatExt

# [−][src]Trait std::slice::SliceConcatExt

    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

An extension trait for concatenating slices

While this trait is unstable, the methods are stable. `SliceConcatExt` is included in the standard library prelude, so you can use `join()` and `concat()` as if they existed on `[T]` itself.

## Associated Types

### `type Output`

🔬 This is a nightly-only experimental API. (`slice_concat_ext` #27747)

trait should not have to exist

The resulting type after concatenation

Loading content...

## Required methods

### `fn concat(&self) -> Self::Output`1.0.0

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::Output`1.3.0

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");
    assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);Run

### `fn connect(&self, sep: &T) -> Self::Output`1.0.0

Deprecated since 1.3.0:

renamed to join

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

# Examples

    assert_eq!(["hello", "world"].connect(" "), "hello world");
    assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);Run

Loading content...

## Implementors

### `impl<S> SliceConcatExt<str> for [S] where
S: Borrow<str>,` [src]

#### `type Output = String`

🔬 This is a nightly-only experimental API. (`slice_concat_ext` #27747)

trait should not have to exist

#### `fn concat(&self) -> String`[src]

#### `fn join(&self, sep: &str) -> String`[src]

#### `fn connect(&self, sep: &str) -> String`[src]

Deprecated since 1.3.0:

renamed to join

### `impl<T, V> SliceConcatExt<T> for [V] where
T: Clone,
V: Borrow<[T]>,` [src]

#### `type Output = Vec<T>`

🔬 This is a nightly-only experimental API. (`slice_concat_ext` #27747)

trait should not have to exist

####
ⓘImportant traits for Vec<u8>

### Important traits for Vec<u8>

`impl Write for Vec<u8>`
`fn concat(&self) -> Vec<T>`[src]

####
ⓘImportant traits for Vec<u8>

### Important traits for Vec<u8>

`impl Write for Vec<u8>`
`fn join(&self, sep: &T) -> Vec<T>`[src]

####
ⓘImportant traits for Vec<u8>

### Important traits for Vec<u8>

`impl Write for Vec<u8>`
`fn connect(&self, sep: &T) -> Vec<T>`[src]

Deprecated since 1.3.0:

renamed to join

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)