Coverage Report

Created: 2024-10-16 07:58

/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
230k
    fn equivalent(&self, key: &K) -> bool {
25
230k
        *self == *key.borrow()
26
230k
    }
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
109
    fn equivalent(&self, key: &K) -> bool {
25
109
        *self == *key.borrow()
26
109
    }
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <gimli::write::cfi::CommonInformationEntry as indexmap::equivalent::Equivalent<gimli::write::cfi::CommonInformationEntry>>::equivalent
Unexecuted instantiation: <gimli::write::loc::LocationList as indexmap::equivalent::Equivalent<gimli::write::loc::LocationList>>::equivalent
Unexecuted instantiation: <gimli::write::line::LineString as indexmap::equivalent::Equivalent<gimli::write::line::LineString>>::equivalent
Unexecuted instantiation: <gimli::write::range::RangeList as indexmap::equivalent::Equivalent<gimli::write::range::RangeList>>::equivalent
Unexecuted instantiation: <gimli::write::abbrev::Abbreviation as indexmap::equivalent::Equivalent<gimli::write::abbrev::Abbreviation>>::equivalent
Unexecuted instantiation: <(gimli::write::line::LineString, gimli::write::line::DirectoryId) as indexmap::equivalent::Equivalent<(gimli::write::line::LineString, gimli::write::line::DirectoryId)>>::equivalent
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
15.9k
    fn equivalent(&self, key: &K) -> bool {
25
15.9k
        *self == *key.borrow()
26
15.9k
    }
Unexecuted instantiation: <wasmer_types::module::ImportKey as indexmap::equivalent::Equivalent<wasmer_types::module::ImportKey>>::equivalent
<str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
1.50k
    fn equivalent(&self, key: &K) -> bool {
25
1.50k
        *self == *key.borrow()
26
1.50k
    }
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
192k
    fn equivalent(&self, key: &K) -> bool {
25
192k
        *self == *key.borrow()
26
192k
    }
Unexecuted instantiation: <wasmer_types::module::ImportKey as indexmap::equivalent::Equivalent<wasmer_types::module::ImportKey>>::equivalent
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
1.01k
    fn equivalent(&self, key: &K) -> bool {
25
1.01k
        *self == *key.borrow()
26
1.01k
    }
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
<alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
2.34k
    fn equivalent(&self, key: &K) -> bool {
25
2.34k
        *self == *key.borrow()
26
2.34k
    }
Unexecuted instantiation: <wasmer_types::module::ImportKey as indexmap::equivalent::Equivalent<wasmer_types::module::ImportKey>>::equivalent
<str as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Line
Count
Source
24
17.2k
    fn equivalent(&self, key: &K) -> bool {
25
17.2k
        *self == *key.borrow()
26
17.2k
    }
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <wasmer_types::module::ImportKey as indexmap::equivalent::Equivalent<wasmer_types::module::ImportKey>>::equivalent
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
Unexecuted instantiation: <alloc::string::String as indexmap::equivalent::Equivalent<alloc::string::String>>::equivalent
27
}