spinoso_array/array/tinyvec/
eq.rs

1use alloc::boxed::Box;
2use alloc::vec::Vec;
3
4use tinyvec::TinyVec;
5
6use crate::array::INLINE_CAPACITY;
7use crate::array::tinyvec::TinyArray;
8use crate::array::vec::Array;
9
10impl<T, U> PartialEq<TinyVec<[U; INLINE_CAPACITY]>> for TinyArray<T>
11where
12    T: PartialEq<U> + Default,
13    U: Default,
14{
15    #[inline]
16    fn eq(&self, other: &TinyVec<[U; INLINE_CAPACITY]>) -> bool {
17        self[..] == other[..]
18    }
19}
20
21impl<T, U> PartialEq<TinyArray<U>> for TinyVec<[T; INLINE_CAPACITY]>
22where
23    T: PartialEq<U> + Default,
24    U: Default,
25{
26    #[inline]
27    fn eq(&self, other: &TinyArray<U>) -> bool {
28        self[..] == other[..]
29    }
30}
31
32impl<T, U> PartialEq<Vec<U>> for TinyArray<T>
33where
34    T: PartialEq<U> + Default,
35{
36    #[inline]
37    fn eq(&self, other: &Vec<U>) -> bool {
38        self[..] == other[..]
39    }
40}
41
42impl<T, U> PartialEq<TinyArray<U>> for Vec<T>
43where
44    T: PartialEq<U>,
45    U: Default,
46{
47    #[inline]
48    fn eq(&self, other: &TinyArray<U>) -> bool {
49        self[..] == other[..]
50    }
51}
52
53impl<T, U> PartialEq<[U]> for TinyArray<T>
54where
55    T: PartialEq<U> + Default,
56{
57    #[inline]
58    fn eq(&self, other: &[U]) -> bool {
59        self[..] == other[..]
60    }
61}
62
63impl<T, U> PartialEq<TinyArray<U>> for [T]
64where
65    T: PartialEq<U>,
66    U: Default,
67{
68    #[inline]
69    fn eq(&self, other: &TinyArray<U>) -> bool {
70        self[..] == other[..]
71    }
72}
73
74impl<T, U> PartialEq<Box<[U]>> for TinyArray<T>
75where
76    T: PartialEq<U> + Default,
77{
78    #[inline]
79    fn eq(&self, other: &Box<[U]>) -> bool {
80        self[..] == other[..]
81    }
82}
83
84impl<T, U> PartialEq<TinyArray<U>> for Box<[T]>
85where
86    T: PartialEq<U>,
87    U: Default,
88{
89    #[inline]
90    fn eq(&self, other: &TinyArray<U>) -> bool {
91        self[..] == other[..]
92    }
93}
94
95impl<T, U> PartialEq<TinyArray<U>> for Array<T>
96where
97    T: PartialEq<U>,
98    U: Default,
99{
100    #[inline]
101    fn eq(&self, other: &TinyArray<U>) -> bool {
102        self[..] == other[..]
103    }
104}
105
106impl<T, U> PartialEq<Array<U>> for TinyArray<T>
107where
108    T: PartialEq<U> + Default,
109{
110    #[inline]
111    fn eq(&self, other: &Array<U>) -> bool {
112        self[..] == other[..]
113    }
114}
115
116impl<T, U, const N: usize> PartialEq<[U; N]> for TinyArray<T>
117where
118    T: PartialEq<U> + Default,
119{
120    #[inline]
121    fn eq(&self, other: &[U; N]) -> bool {
122        self[..] == other[..]
123    }
124}
125
126impl<T, U, const N: usize> PartialEq<TinyArray<U>> for [T; N]
127where
128    T: PartialEq<U>,
129    U: Default,
130{
131    #[inline]
132    fn eq(&self, other: &TinyArray<U>) -> bool {
133        self[..] == other[..]
134    }
135}
136
137impl<T, U, const N: usize> PartialEq<&[U; N]> for TinyArray<T>
138where
139    T: PartialEq<U> + Default,
140{
141    #[inline]
142    fn eq(&self, other: &&[U; N]) -> bool {
143        self[..] == other[..]
144    }
145}
146
147impl<T, U, const N: usize> PartialEq<TinyArray<U>> for &[T; N]
148where
149    T: PartialEq<U>,
150    U: Default,
151{
152    #[inline]
153    fn eq(&self, other: &TinyArray<U>) -> bool {
154        self[..] == other[..]
155    }
156}