rspace_traits/
container.rs1use crate::space::RawSpace;
7
8pub trait Container<U>
11where
12 Self::Cont<U>: RawSpace<Elem = U>,
13{
14 type Cont<V>: ?Sized;
15}
16
17pub trait ContainerIter<U>: Container<U>
18where
19 Self::Cont<U>: RawSpace<Elem = U>,
20{
21 type Iter<'a, T>: Iterator<Item = &'a T>
22 where
23 Self: 'a,
24 T: 'a;
25}
26
27#[allow(unused_macros)]
31macro_rules! container {
32 (@impl $trait:ident<$T:ident> for $($cont:ident)::*<$($U:ident),+ $(,)?>) => {
33 paste::paste! {
34 impl<$($U),+> $trait<$T> for $($cont)::*<$($U),+> {
35 type Cont<[<_ $T>]> = $($cont)::*<[<_ $T>]>;
36 }
37
38 }
39 };
40 (impl $trait:ident<$T:ident> for {$($($cont:ident)::*<$($U:ident),+ $(,)?>),* $(,)?}) => {
41 $(container!{ @impl $trait<$T> for $($cont)::*<$($U),+>})*
42 };
43}