Skip to content

Commit a9f1026

Browse files
committed
Implement PartialEq/Eq for SliceInfo
1 parent ce80d38 commit a9f1026

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/slice.rs

+19
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,25 @@ pub struct SliceInfo<T: ?Sized, D: Dimension> {
295295
indices: T,
296296
}
297297

298+
impl<T1, D1, T2, D2> PartialEq<SliceInfo<T2, D2>> for SliceInfo<T1, D1>
299+
where
300+
T1: AsRef<[SliceOrIndex]>,
301+
T2: AsRef<[SliceOrIndex]>,
302+
D1: Dimension,
303+
D2: Dimension,
304+
{
305+
fn eq(&self, other: &SliceInfo<T2, D2>) -> bool {
306+
self.indices.as_ref() == other.indices.as_ref()
307+
}
308+
}
309+
310+
impl<T, D> Eq for SliceInfo<T, D>
311+
where
312+
T: AsRef<[SliceOrIndex]>,
313+
D: Dimension,
314+
{
315+
}
316+
298317
impl<T: ?Sized, D> Deref for SliceInfo<T, D>
299318
where
300319
D: Dimension,

0 commit comments

Comments
 (0)