rspace_traits/impls/
impl_container.rs1use crate::container::Container;
7use crate::space::RawSpace;
8
9impl<S, T> Container<T> for S
10where
11 S: RawSpace<Elem = T>,
12{
13 type Cont<V> = S;
14}
15
16impl<T> Container<T> for [T] {
17 type Cont<U> = [U];
18}
19
20#[allow(unused_macros)]
21macro_rules! container {
22 (@impl $trait:ident<$T:ident> for $($cont:ident)::*<$($U:ident),+ $(,)?>) => {
23 paste::paste! {
24 impl<$($U),+> $trait<$T> for $($cont)::*<$($U),+> {
25 type Cont<[<_ $T>]> = $($cont)::*<[<_ $T>]>;
26 }
27
28 }
29 };
30 (impl $trait:ident<$T:ident> for {$($($cont:ident)::*<$($U:ident),+ $(,)?>),* $(,)?}) => {
31 $(container!{ @impl $trait<$T> for $($cont)::*<$($U),+>})*
32 };
33}