Coverage Report

Created: 2025-12-31 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wasmi/crates/collections/src/arena/guarded.rs
Line
Count
Source
1
use crate::arena::ArenaIndex;
2
3
/// A guarded entity.
4
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5
pub struct GuardedEntity<GuardIdx, EntityIdx> {
6
    guard_idx: GuardIdx,
7
    entity_idx: EntityIdx,
8
}
9
10
impl<GuardIdx, EntityIdx> GuardedEntity<GuardIdx, EntityIdx> {
11
    /// Creates a new [`GuardedEntity`].
12
    #[inline]
13
1.34M
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
1.34M
        Self {
15
1.34M
            guard_idx,
16
1.34M
            entity_idx,
17
1.34M
        }
18
1.34M
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::func::TrampolineIdx>>::new
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::engine::EngineIdx, wasmi::engine::func_types::DedupFuncTypeIdx>>::new
Line
Count
Source
13
106k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
106k
        Self {
15
106k
            guard_idx,
16
106k
            entity_idx,
17
106k
        }
18
106k
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::reftype::ExternRef>>>::new
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::func::Func>>>::new
Line
Count
Source
13
293k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
293k
        Self {
15
293k
            guard_idx,
16
293k
            entity_idx,
17
293k
        }
18
293k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::TableIdx>>::new
Line
Count
Source
13
39.3k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
39.3k
        Self {
15
39.3k
            guard_idx,
16
39.3k
            entity_idx,
17
39.3k
        }
18
39.3k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::global::GlobalIdx>>::new
Line
Count
Source
13
124k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
124k
        Self {
15
124k
            guard_idx,
16
124k
            entity_idx,
17
124k
        }
18
124k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::MemoryIdx>>::new
Line
Count
Source
13
18.9k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
18.9k
        Self {
15
18.9k
            guard_idx,
16
18.9k
            entity_idx,
17
18.9k
        }
18
18.9k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::instance::InstanceIdx>>::new
Line
Count
Source
13
14.7k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
14.7k
        Self {
15
14.7k
            guard_idx,
16
14.7k
            entity_idx,
17
14.7k
        }
18
14.7k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::element::ElementSegmentIdx>>::new
Line
Count
Source
13
55.2k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
55.2k
        Self {
15
55.2k
            guard_idx,
16
55.2k
            entity_idx,
17
55.2k
        }
18
55.2k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::data::DataSegmentIdx>>::new
Line
Count
Source
13
32.3k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
32.3k
        Self {
15
32.3k
            guard_idx,
16
32.3k
            entity_idx,
17
32.3k
        }
18
32.3k
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<_, _>>::new
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::engine::EngineIdx, wasmi::engine::func_types::DedupFuncTypeIdx>>::new
Line
Count
Source
13
224k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
224k
        Self {
15
224k
            guard_idx,
16
224k
            entity_idx,
17
224k
        }
18
224k
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::reftype::ExternRef>>>::new
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::func::Func>>>::new
Line
Count
Source
13
257k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
257k
        Self {
15
257k
            guard_idx,
16
257k
            entity_idx,
17
257k
        }
18
257k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::TableIdx>>::new
Line
Count
Source
13
24.1k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
24.1k
        Self {
15
24.1k
            guard_idx,
16
24.1k
            entity_idx,
17
24.1k
        }
18
24.1k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::global::GlobalIdx>>::new
Line
Count
Source
13
63.9k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
63.9k
        Self {
15
63.9k
            guard_idx,
16
63.9k
            entity_idx,
17
63.9k
        }
18
63.9k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::MemoryIdx>>::new
Line
Count
Source
13
31.5k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
31.5k
        Self {
15
31.5k
            guard_idx,
16
31.5k
            entity_idx,
17
31.5k
        }
18
31.5k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::instance::InstanceIdx>>::new
Line
Count
Source
13
12.3k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
12.3k
        Self {
15
12.3k
            guard_idx,
16
12.3k
            entity_idx,
17
12.3k
        }
18
12.3k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::element::ElementSegmentIdx>>::new
Line
Count
Source
13
28.3k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
28.3k
        Self {
15
28.3k
            guard_idx,
16
28.3k
            entity_idx,
17
28.3k
        }
18
28.3k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::data::DataSegmentIdx>>::new
Line
Count
Source
13
15.5k
    pub fn new(guard_idx: GuardIdx, entity_idx: EntityIdx) -> Self {
14
15.5k
        Self {
15
15.5k
            guard_idx,
16
15.5k
            entity_idx,
17
15.5k
        }
18
15.5k
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::func::TrampolineIdx>>::new
19
}
20
21
impl<GuardIdx, EntityIdx> GuardedEntity<GuardIdx, EntityIdx>
22
where
23
    GuardIdx: ArenaIndex,
24
    EntityIdx: ArenaIndex,
25
{
26
    /// Returns the entity index of the [`GuardedEntity`].
27
    ///
28
    /// Return `None` if the `guard_index` does not match.
29
    #[inline]
30
28.2M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
28.2M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
28.2M
        }
34
28.2M
        Some(self.entity_idx)
35
28.2M
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::func::TrampolineIdx>>::entity_index
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::engine::EngineIdx, wasmi::engine::func_types::DedupFuncTypeIdx>>::entity_index
Line
Count
Source
30
1.39M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
1.39M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
1.39M
        }
34
1.39M
        Some(self.entity_idx)
35
1.39M
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::reftype::ExternRef>>>::entity_index
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::func::Func>>>::entity_index
Line
Count
Source
30
1.14M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
1.14M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
1.14M
        }
34
1.14M
        Some(self.entity_idx)
35
1.14M
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::TableIdx>>::entity_index
Line
Count
Source
30
612k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
612k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
612k
        }
34
612k
        Some(self.entity_idx)
35
612k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::global::GlobalIdx>>::entity_index
Line
Count
Source
30
15.3M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
15.3M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
15.3M
        }
34
15.3M
        Some(self.entity_idx)
35
15.3M
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::MemoryIdx>>::entity_index
Line
Count
Source
30
984k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
984k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
984k
        }
34
984k
        Some(self.entity_idx)
35
984k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::instance::InstanceIdx>>::entity_index
Line
Count
Source
30
2.22M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
2.22M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
2.22M
        }
34
2.22M
        Some(self.entity_idx)
35
2.22M
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::element::ElementSegmentIdx>>::entity_index
Line
Count
Source
30
1.80M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
1.80M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
1.80M
        }
34
1.80M
        Some(self.entity_idx)
35
1.80M
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::data::DataSegmentIdx>>::entity_index
Line
Count
Source
30
1.39M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
1.39M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
1.39M
        }
34
1.39M
        Some(self.entity_idx)
35
1.39M
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<_, _>>::entity_index
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::engine::EngineIdx, wasmi::engine::func_types::DedupFuncTypeIdx>>::entity_index
Line
Count
Source
30
1.83M
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
1.83M
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
1.83M
        }
34
1.83M
        Some(self.entity_idx)
35
1.83M
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::reftype::ExternRef>>>::entity_index
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::reftype::RefId<wasmi::func::Func>>>::entity_index
Line
Count
Source
30
685k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
685k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
685k
        }
34
685k
        Some(self.entity_idx)
35
685k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::TableIdx>>::entity_index
Line
Count
Source
30
58.2k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
58.2k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
58.2k
        }
34
58.2k
        Some(self.entity_idx)
35
58.2k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::global::GlobalIdx>>::entity_index
Line
Count
Source
30
188k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
188k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
188k
        }
34
188k
        Some(self.entity_idx)
35
188k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::MemoryIdx>>::entity_index
Line
Count
Source
30
209k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
209k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
209k
        }
34
209k
        Some(self.entity_idx)
35
209k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::instance::InstanceIdx>>::entity_index
Line
Count
Source
30
243k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
243k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
243k
        }
34
243k
        Some(self.entity_idx)
35
243k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::table::element::ElementSegmentIdx>>::entity_index
Line
Count
Source
30
97.8k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
97.8k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
97.8k
        }
34
97.8k
        Some(self.entity_idx)
35
97.8k
    }
<wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::memory::data::DataSegmentIdx>>::entity_index
Line
Count
Source
30
60.2k
    pub fn entity_index(&self, guard_index: GuardIdx) -> Option<EntityIdx> {
31
60.2k
        if self.guard_idx.into_usize() != guard_index.into_usize() {
32
0
            return None;
33
60.2k
        }
34
60.2k
        Some(self.entity_idx)
35
60.2k
    }
Unexecuted instantiation: <wasmi_collections::arena::guarded::GuardedEntity<wasmi::store::inner::StoreIdx, wasmi::func::TrampolineIdx>>::entity_index
36
}