/rust/registry/src/index.crates.io-6f17d22bba15001f/indexmap-1.9.3/src/equivalent.rs
Line | Count | Source |
1 | | use core::borrow::Borrow; |
2 | | |
3 | | /// Key equivalence trait. |
4 | | /// |
5 | | /// This trait allows hash table lookup to be customized. |
6 | | /// It has one blanket implementation that uses the regular `Borrow` solution, |
7 | | /// just like `HashMap` and `BTreeMap` do, so that you can pass `&str` to lookup |
8 | | /// into a map with `String` keys and so on. |
9 | | /// |
10 | | /// # Contract |
11 | | /// |
12 | | /// The implementor **must** hash like `K`, if it is hashable. |
13 | | pub trait Equivalent<K: ?Sized> { |
14 | | /// Compare self to `key` and return `true` if they are equal. |
15 | | fn equivalent(&self, key: &K) -> bool; |
16 | | } |
17 | | |
18 | | impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q |
19 | | where |
20 | | Q: Eq, |
21 | | K: Borrow<Q>, |
22 | | { |
23 | | #[inline] |
24 | 17.2M | fn equivalent(&self, key: &K) -> bool { |
25 | 17.2M | *self == *key.borrow() |
26 | 17.2M | } Unexecuted instantiation: <&wasm_mutate::mutators::peephole::eggsy::lang::Lang as indexmap::equivalent::Equivalent<&wasm_mutate::mutators::peephole::eggsy::lang::Lang>>::equivalent <core::mem::Discriminant<wasm_mutate::mutators::peephole::eggsy::lang::Lang> as indexmap::equivalent::Equivalent<core::mem::Discriminant<wasm_mutate::mutators::peephole::eggsy::lang::Lang>>>::equivalent Line | Count | Source | 24 | 82.1k | fn equivalent(&self, key: &K) -> bool { | 25 | 82.1k | *self == *key.borrow() | 26 | 82.1k | } |
<egg::Id as indexmap::equivalent::Equivalent<egg::Id>>::equivalent Line | Count | Source | 24 | 11.0k | fn equivalent(&self, key: &K) -> bool { | 25 | 11.0k | *self == *key.borrow() | 26 | 11.0k | } |
<egg::subst::Var as indexmap::equivalent::Equivalent<egg::subst::Var>>::equivalent Line | Count | Source | 24 | 45.1k | fn equivalent(&self, key: &K) -> bool { | 25 | 45.1k | *self == *key.borrow() | 26 | 45.1k | } |
<str as indexmap::equivalent::Equivalent<&str>>::equivalent Line | Count | Source | 24 | 1.66M | fn equivalent(&self, key: &K) -> bool { | 25 | 1.66M | *self == *key.borrow() | 26 | 1.66M | } |
Unexecuted instantiation: <&str as indexmap::equivalent::Equivalent<&str>>::equivalent <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent Line | Count | Source | 24 | 935k | fn equivalent(&self, key: &K) -> bool { | 25 | 935k | *self == *key.borrow() | 26 | 935k | } |
<(alloc::string::String, alloc::string::String) as indexmap::equivalent::Equivalent<(alloc::string::String, alloc::string::String)>>::equivalent Line | Count | Source | 24 | 416k | fn equivalent(&self, key: &K) -> bool { | 25 | 416k | *self == *key.borrow() | 26 | 416k | } |
<wasmparser::validator::types::KebabString as indexmap::equivalent::Equivalent<wasmparser::validator::types::KebabString>>::equivalent Line | Count | Source | 24 | 812k | fn equivalent(&self, key: &K) -> bool { | 25 | 812k | *self == *key.borrow() | 26 | 812k | } |
Unexecuted instantiation: <dyn wasmparser::validator::types::ModuleImportKey as indexmap::equivalent::Equivalent<(alloc::string::String, alloc::string::String)>>::equivalent <&wasmparser::validator::types::KebabStr as indexmap::equivalent::Equivalent<&wasmparser::validator::types::KebabStr>>::equivalent Line | Count | Source | 24 | 45.3k | fn equivalent(&self, key: &K) -> bool { | 25 | 45.3k | *self == *key.borrow() | 26 | 45.3k | } |
<wasmparser::validator::types::KebabStr as indexmap::equivalent::Equivalent<wasmparser::validator::types::KebabString>>::equivalent Line | Count | Source | 24 | 815k | fn equivalent(&self, key: &K) -> bool { | 25 | 815k | *self == *key.borrow() | 26 | 815k | } |
<&str as indexmap::equivalent::Equivalent<&str>>::equivalent Line | Count | Source | 24 | 245k | fn equivalent(&self, key: &K) -> bool { | 25 | 245k | *self == *key.borrow() | 26 | 245k | } |
<str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent Line | Count | Source | 24 | 5.65M | fn equivalent(&self, key: &K) -> bool { | 25 | 5.65M | *self == *key.borrow() | 26 | 5.65M | } |
<str as indexmap::equivalent::Equivalent<&str>>::equivalent Line | Count | Source | 24 | 602k | fn equivalent(&self, key: &K) -> bool { | 25 | 602k | *self == *key.borrow() | 26 | 602k | } |
Unexecuted instantiation: <_ as indexmap::equivalent::Equivalent<_>>::equivalent <core::option::Option<&str> as indexmap::equivalent::Equivalent<core::option::Option<&str>>>::equivalent Line | Count | Source | 24 | 124k | fn equivalent(&self, key: &K) -> bool { | 25 | 124k | *self == *key.borrow() | 26 | 124k | } |
<id_arena::Id<wit_parser::Interface> as indexmap::equivalent::Equivalent<id_arena::Id<wit_parser::Interface>>>::equivalent Line | Count | Source | 24 | 1.14M | fn equivalent(&self, key: &K) -> bool { | 25 | 1.14M | *self == *key.borrow() | 26 | 1.14M | } |
<wit_component::encoding::ShimKind as indexmap::equivalent::Equivalent<wit_component::encoding::ShimKind>>::equivalent Line | Count | Source | 24 | 56.7k | fn equivalent(&self, key: &K) -> bool { | 25 | 56.7k | *self == *key.borrow() | 26 | 56.7k | } |
<url::Url as indexmap::equivalent::Equivalent<url::Url>>::equivalent Line | Count | Source | 24 | 408k | fn equivalent(&self, key: &K) -> bool { | 25 | 408k | *self == *key.borrow() | 26 | 408k | } |
<&wit_parser::abi::WasmSignature as indexmap::equivalent::Equivalent<&wit_parser::abi::WasmSignature>>::equivalent Line | Count | Source | 24 | 29.8k | fn equivalent(&self, key: &K) -> bool { | 25 | 29.8k | *self == *key.borrow() | 26 | 29.8k | } |
<usize as indexmap::equivalent::Equivalent<usize>>::equivalent Line | Count | Source | 24 | 123k | fn equivalent(&self, key: &K) -> bool { | 25 | 123k | *self == *key.borrow() | 26 | 123k | } |
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent Line | Count | Source | 24 | 1.04M | fn equivalent(&self, key: &K) -> bool { | 25 | 1.04M | *self == *key.borrow() | 26 | 1.04M | } |
<id_arena::Id<wit_parser::TypeDef> as indexmap::equivalent::Equivalent<id_arena::Id<wit_parser::TypeDef>>>::equivalent Line | Count | Source | 24 | 184k | fn equivalent(&self, key: &K) -> bool { | 25 | 184k | *self == *key.borrow() | 26 | 184k | } |
Unexecuted instantiation: <std::path::PathBuf as indexmap::equivalent::Equivalent<std::path::PathBuf>>::equivalent Unexecuted instantiation: <std::path::Path as indexmap::equivalent::Equivalent<std::path::PathBuf>>::equivalent Unexecuted instantiation: <std::path::Path as indexmap::equivalent::Equivalent<&std::path::Path>>::equivalent Unexecuted instantiation: <&std::path::Path as indexmap::equivalent::Equivalent<&std::path::Path>>::equivalent <str as indexmap::equivalent::Equivalent<&str>>::equivalent Line | Count | Source | 24 | 1.52M | fn equivalent(&self, key: &K) -> bool { | 25 | 1.52M | *self == *key.borrow() | 26 | 1.52M | } |
<&str as indexmap::equivalent::Equivalent<&str>>::equivalent Line | Count | Source | 24 | 1.24M | fn equivalent(&self, key: &K) -> bool { | 25 | 1.24M | *self == *key.borrow() | 26 | 1.24M | } |
<str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent Line | Count | Source | 24 | 75.2k | fn equivalent(&self, key: &K) -> bool { | 25 | 75.2k | *self == *key.borrow() | 26 | 75.2k | } |
|
27 | | } |