mirror of
https://git.proxmox.com/git/rustc
synced 2025-06-26 21:35:53 +00:00
16 lines
284 B
Rust
16 lines
284 B
Rust
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())
|
|
}
|
|
}
|