Trait sp_std::slice::Concat [−][src]
🔬 This is a nightly-only experimental API. (
slice_concat_trait
)Helper trait for [T]::concat
.
Note: the Item
type parameter is not used in this trait,
but it allows impls to be more generic.
Without it, we get this error:
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
--> src/liballoc/slice.rs:608:6
|
608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
| ^ unconstrained type parameter
This is because there could exist V
types with multiple Borrow<[_]>
impls,
such that multiple T
types would apply:
pub struct Foo(Vec<u32>, Vec<String>); impl std::borrow::Borrow<[u32]> for Foo { fn borrow(&self) -> &[u32] { &self.0 } } impl std::borrow::Borrow<[String]> for Foo { fn borrow(&self) -> &[String] { &self.1 } }
Associated Types
type Output
[src]
🔬 This is a nightly-only experimental API. (
slice_concat_trait
)The resulting type after concatenation
Required methods
pub fn concat(slice: &Self) -> Self::Output
[src]
🔬 This is a nightly-only experimental API. (
slice_concat_trait
)Implementation of [T]::concat
Implementations on Foreign Types
impl<S> Concat<str> for [S] where
S: Borrow<str>,
[src]
S: Borrow<str>,
Note: str
in Concat<str>
is not meaningful here.
This type parameter of the trait only exists to enable another impl.
type Output = String
🔬 This is a nightly-only experimental API. (
slice_concat_trait
)pub fn concat(slice: &[S]) -> String
[src]
impl<T, V> Concat<T> for [V] where
T: Clone,
V: Borrow<[T]>,
[src]
T: Clone,
V: Borrow<[T]>,
type Output = Vec<T, Global>
🔬 This is a nightly-only experimental API. (
slice_concat_trait
)