Skip to main content

alloc/collections/vec_deque/
macros.rs

1macro_rules! __impl_slice_eq1 {
2    ([$($vars:tt)*] $lhs:ty, $rhs:ty, $($constraints:tt)*) => {
3        #[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")]
4        impl<T, U, A: Allocator, $($vars)*> PartialEq<$rhs> for $lhs
5        where
6            T: PartialEq<U>,
7            $($constraints)*
8        {
9            fn eq(&self, other: &$rhs) -> bool {
10                if self.len() != other.len() {
11                    return false;
12                }
13                let (sa, sb) = self.as_slices();
14                let (oa, ob) = other[..].split_at(sa.len());
15                sa == oa && sb == ob
16            }
17        }
18    }
19}
20
21macro_rules! __impl_slice_eq2 {
22    ($(#[$stability:meta])+, [$($vars:tt)*] $lhs:ty, $rhs:ty, $($constraints:tt)*) => {
23        $(#[$stability])+
24        impl<T, U, A: Allocator, $($vars)*> PartialEq<$rhs> for $lhs
25        where
26            T: PartialEq<U>,
27            $($constraints)*
28        {
29            fn eq(&self, other: &$rhs) -> bool {
30                if self.len() != other.len() {
31                    return false;
32                }
33                let (oa, ob) = other.as_slices();
34                let (sa, sb) = self[..].split_at(oa.len());
35                sa == oa && sb == ob
36            }
37        }
38    }
39}