#[cfg(not(no_global_oom_handling))] use alloc_crate::borrow::Cow; use crate::stable::alloc::Allocator; use super::Vec; macro_rules! __impl_slice_eq1 { ([$($vars:tt)*] $lhs:ty, $rhs:ty $(where $ty:ty: $bound:ident)?) => { impl PartialEq<$rhs> for $lhs where T: PartialEq, $($ty: $bound)? { #[inline(always)] fn eq(&self, other: &$rhs) -> bool { self[..] == other[..] } #[inline(always)] fn ne(&self, other: &$rhs) -> bool { self[..] != other[..] } } } } __impl_slice_eq1! { [A1: Allocator, A2: Allocator] Vec, Vec } __impl_slice_eq1! { [A: Allocator] Vec, &[U] } __impl_slice_eq1! { [A: Allocator] Vec, &mut [U] } __impl_slice_eq1! { [A: Allocator] &[T], Vec } __impl_slice_eq1! { [A: Allocator] &mut [T], Vec } __impl_slice_eq1! { [A: Allocator] Vec, [U] } __impl_slice_eq1! { [A: Allocator] [T], Vec } #[cfg(not(no_global_oom_handling))] __impl_slice_eq1! { [A: Allocator] Cow<'_, [T]>, Vec where T: Clone } __impl_slice_eq1! { [A: Allocator, const N: usize] Vec, [U; N] } __impl_slice_eq1! { [A: Allocator, const N: usize] Vec, &[U; N] } // NOTE: some less important impls are omitted to reduce code bloat // FIXME(Centril): Reconsider this? //__impl_slice_eq1! { [const N: usize] Vec, &mut [B; N], } //__impl_slice_eq1! { [const N: usize] [A; N], Vec, } //__impl_slice_eq1! { [const N: usize] &[A; N], Vec, } //__impl_slice_eq1! { [const N: usize] &mut [A; N], Vec, } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, [B; N], } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, &[B; N], } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, &mut [B; N], }