palette/macros/
copy_clone.rs

1macro_rules! impl_copy_clone {
2    (  $self_ty: ident , [$($element: ident),+] $(, $phantom: ident)?) => {
3        impl_copy_clone!($self_ty<>, [$($element),+] $(, $phantom)?);
4    };
5    (  $self_ty: ident < $($phantom_ty: ident)? > , [$($element: ident),+] $(, $phantom: ident)?) => {
6        impl<$($phantom_ty,)? T> Copy for $self_ty<$($phantom_ty,)? T> where T: Copy {}
7
8        impl<$($phantom_ty,)? T> Clone for $self_ty<$($phantom_ty,)? T>
9        where
10            T: Clone,
11        {
12            fn clone(&self) -> $self_ty<$($phantom_ty,)? T> {
13                $self_ty {
14                    $($element: self.$element.clone(),)*
15                    $($phantom: core::marker::PhantomData,)?
16                }
17            }
18        }
19    }
20}