Skip to content

Commit f6ebb02

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

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/slice.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,24 @@ 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+
298316
impl<T: ?Sized, D> Deref for SliceInfo<T, D>
299317
where
300318
D: Dimension,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy