diff options
Diffstat (limited to 'tests/rustdoc-js/auxiliary')
-rw-r--r-- | tests/rustdoc-js/auxiliary/equivalent.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rustdoc-js/auxiliary/equivalent.rs b/tests/rustdoc-js/auxiliary/equivalent.rs new file mode 100644 index 000000000..a19b5a2d4 --- /dev/null +++ b/tests/rustdoc-js/auxiliary/equivalent.rs @@ -0,0 +1,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()) + } +} |