summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-js/auxiliary/equivalent.rs
blob: a19b5a2d44df2e9a5d628f71d7071c141a26a620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::borrow::Borrow;

pub trait Equivalent<K: ?Sized> {
    fn equivalent(&self, key: &K) -> bool;
}

impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q
where
    Q: Eq,
    K: Borrow<Q>,
{
    fn equivalent(&self, key: &K) -> bool {
        PartialEq::eq(self, key.borrow())
    }
}