typed_index_collections/slice/
concat.rs1use alloc::string::String;
2use core::borrow::Borrow;
3
4use crate::{TiSlice, TiVec};
5
6pub trait Concat<Item: ?Sized> {
8 type Output;
10
11 fn concat(slice: &Self) -> Self::Output;
13}
14
15impl<K, V: Borrow<str>> Concat<str> for TiSlice<K, V> {
16 type Output = String;
17
18 #[inline]
19 fn concat(slice: &Self) -> Self::Output {
20 slice.raw.concat()
21 }
22}
23
24impl<K, T: Clone, V: Borrow<[T]>> Concat<T> for TiSlice<K, V> {
25 type Output = TiVec<K, T>;
26
27 #[inline]
28 fn concat(slice: &Self) -> Self::Output {
29 slice.raw.concat().into()
30 }
31}