8000 `impl PartialEq` between `Slice` and `[]`/arrays by cuviper · Pull Request #376 · indexmap-rs/indexmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
10000

impl PartialEq between Slice and []/arrays #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 1, 2025

Conversation

cuviper
Copy link
Member
@cuviper cuviper commented Feb 17, 2025

Added comparisons between Slice and bare slices and arrays:

impl<K, V, K2, V2> PartialEq<[(K2, V2)]> for map::Slice<K, V>
where
    K: PartialEq<K2>,
    V: PartialEq<V2>,

impl<K, V, K2, V2> PartialEq<map::Slice<K2, V2>> for [(K, V)]
where
    K: PartialEq<K2>,
    V: PartialEq<V2>,

impl<K, V, K2, V2, const N: usize> PartialEq<[(K2, V2); N]> for map::Slice<K, V>
where
    K: PartialEq<K2>,
    V: PartialEq<V2>,

impl<K, V, const N: usize, K2, V2> PartialEq<map::Slice<K2, V2>> for [(K, V); N]
where
    K: PartialEq<K2>,
    V: PartialEq<V2>,

impl<T, U> PartialEq<[U]> for set::Slice<T>
where
    T: PartialEq<U>,

impl<T, U> PartialEq<set::Slice<U>> for [T]
where
    T: PartialEq<U>,

impl<T, U, const N: usize> PartialEq<[U; N]> for set::Slice<T>
where
    T: PartialEq<U>,

impl<T, const N: usize, U> PartialEq<set::Slice<U>> for [T; N]
where
    T: PartialEq<U>,

Updated Slice-to-Slice with more generic RHS:

impl<K, V, K2, V2> PartialEq<map::Slice<K2, V2>> for map::Slice<K, V>
where
    K: PartialEq<K2>,
    V: PartialEq<V2>,

impl<T, U> PartialEq<set::Slice<U>> for set::Slice<T>
where
    T: PartialEq<U>,

Resolves #375

```rust
impl<K: PartialEq, V: PartialEq> PartialEq<[(K, V)]> for map::Slice<K, V> {...}
impl<K: PartialEq, V: PartialEq> PartialEq<map::Slice<K, V>> for [(K, V)] {...}

impl<T: PartialEq> PartialEq<[T]> for set::Slice<T> {...}
impl<T: PartialEq> PartialEq<set::Slice<T>> for [T] {...}
```

Resolves indexmap-rs#375
@cuviper cuviper changed the title impl PartialEq between Slice and [] impl PartialEq between Slice and []/arrays Feb 17, 2025
@cuviper cuviper added this pull request to the merge queue Mar 1, 2025
Merged via the queue into indexmap-rs:main with commit 5b133ae Mar 1, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: PartialEq<[T]> for set::Slice, PartialEq<[(K, V)]> for map::Slice
1 participant
0