Skip to content

Commit

Permalink
Implement PartialEq/Eq for SliceInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
aldanor committed Aug 19, 2019
1 parent ce80d38 commit f6ebb02
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,24 @@ pub struct SliceInfo<T: ?Sized, D: Dimension> {
indices: T,
}

impl<T1, D1, T2, D2> PartialEq<SliceInfo<T2, D2>> for SliceInfo<T1, D1>
where
T1: AsRef<[SliceOrIndex]>,
T2: AsRef<[SliceOrIndex]>,
D1: Dimension,
D2: Dimension,
{
fn eq(&self, other: &SliceInfo<T2, D2>) -> bool {
self.indices.as_ref() == other.indices.as_ref()
}
}

impl<T, D> Eq for SliceInfo<T, D>
where
T: AsRef<[SliceOrIndex]>,
D: Dimension,
{ }

impl<T: ?Sized, D> Deref for SliceInfo<T, D>
where
D: Dimension,
Expand Down

0 comments on commit f6ebb02

Please sign in to comment.