SliceMeta: PartialEq with slice

no-dual
Avril 3 years ago
parent 9a01d6f133
commit 9836850691
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -33,6 +33,23 @@ pub struct SliceMeta<T = AnySlice>
_slice: PhantomData<[T]>,
}
impl<T, U: ?Sized> PartialEq<U> for SliceMeta<T>
where U: AsRef<[T]>
{
#[inline] fn eq(&self, other: &U) -> bool
{
SliceMeta::from_slice_any(other.as_ref()) == self.as_any()
}
}
impl<T, U: AsRef<[T]>> From<U> for SliceMeta<T>
{
fn from(from: U) -> Self
{
Self::from_slice(from.as_ref())
}
}
impl SliceMeta<AnySlice>
{

Loading…
Cancel
Save