pub trait Concat<Item>where
Item: ?Sized,{
type Output;
// Required method
fn concat(slice: &Self) -> Self::Output;
}
🔬This is a nightly-only experimental API. (
slice_concat_trait
#27747)Expand description
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
--> library/alloc/src/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:
Required Associated Types§
Required Methods§
Sourcefn concat(slice: &Self) -> Self::Output
🔬This is a nightly-only experimental API. (slice_concat_trait
#27747)
fn concat(slice: &Self) -> Self::Output
slice_concat_trait
#27747)Implementation of [T]::concat
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.