/src/wasm-tools/crates/wasmparser/src/readers.rs
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright 2018 Mozilla Foundation |
2 | | * |
3 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | * you may not use this file except in compliance with the License. |
5 | | * You may obtain a copy of the License at |
6 | | * |
7 | | * http://www.apache.org/licenses/LICENSE-2.0 |
8 | | * |
9 | | * Unless required by applicable law or agreed to in writing, software |
10 | | * distributed under the License is distributed on an "AS IS" BASIS, |
11 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | * See the License for the specific language governing permissions and |
13 | | * limitations under the License. |
14 | | */ |
15 | | |
16 | | use crate::{BinaryReader, BinaryReaderError, Result}; |
17 | | use ::core::fmt; |
18 | | use ::core::marker; |
19 | | use ::core::ops::Range; |
20 | | |
21 | | #[cfg(feature = "component-model")] |
22 | | mod component; |
23 | | mod core; |
24 | | |
25 | | #[cfg(feature = "component-model")] |
26 | | pub use self::component::*; |
27 | | pub use self::core::*; |
28 | | |
29 | | /// A trait implemented for items that can be decoded directly from a |
30 | | /// `BinaryReader`, or that which can be parsed from the WebAssembly binary |
31 | | /// format. |
32 | | /// |
33 | | /// Note that this is also accessible as a [`BinaryReader::read`] method. |
34 | | pub trait FromReader<'a>: Sized { |
35 | | /// Attempts to read `Self` from the provided binary reader, returning an |
36 | | /// error if it is unable to do so. |
37 | | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self>; |
38 | | } |
39 | | |
40 | | impl<'a> FromReader<'a> for bool { |
41 | 0 | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
42 | 0 | match reader.read_u8()? { |
43 | 0 | 0 => Ok(false), |
44 | 0 | 1 => Ok(true), |
45 | 0 | _ => Err(BinaryReaderError::new( |
46 | 0 | "invalid boolean value", |
47 | 0 | reader.original_position() - 1, |
48 | 0 | )), |
49 | | } |
50 | 0 | } |
51 | | } |
52 | | |
53 | | impl<'a> FromReader<'a> for u32 { |
54 | 4.45M | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
55 | 4.45M | reader.read_var_u32() |
56 | 4.45M | } |
57 | | } |
58 | | |
59 | | impl<'a> FromReader<'a> for &'a str { |
60 | 2.56M | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
61 | 2.56M | reader.read_string() |
62 | 2.56M | } |
63 | | } |
64 | | |
65 | | impl<'a, T, U> FromReader<'a> for (T, U) |
66 | | where |
67 | | T: FromReader<'a>, |
68 | | U: FromReader<'a>, |
69 | | { |
70 | 566k | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
71 | 566k | Ok((reader.read()?, reader.read()?)) |
72 | 566k | } |
73 | | } |
74 | | |
75 | | /// A generic structure for reading a section of a WebAssembly binary which has |
76 | | /// a limited number of items within it. |
77 | | /// |
78 | | /// Many WebAssembly sections are a count of items followed by that many items. |
79 | | /// This helper structure can be used to parse these sections and provides |
80 | | /// an iteration-based API for reading the contents. |
81 | | /// |
82 | | /// Note that this always implements the [`Clone`] trait to represent the |
83 | | /// ability to parse the section multiple times. |
84 | | pub struct SectionLimited<'a, T> { |
85 | | reader: BinaryReader<'a>, |
86 | | count: u32, |
87 | | _marker: marker::PhantomData<T>, |
88 | | } |
89 | | |
90 | | impl<'a, T> SectionLimited<'a, T> { |
91 | | /// Creates a new section reader from the provided contents. |
92 | | /// |
93 | | /// The `data` provided here is the data of the section itself that will be |
94 | | /// parsed. The `offset` argument is the byte offset, in the original wasm |
95 | | /// binary, that the section was found. The `offset` argument is used |
96 | | /// for error reporting. |
97 | | /// |
98 | | /// # Errors |
99 | | /// |
100 | | /// Returns an error if a 32-bit count couldn't be read from the `data`. |
101 | 1.28M | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { |
102 | 1.28M | let count = reader.read_var_u32()?; |
103 | 1.28M | Ok(SectionLimited { |
104 | 1.28M | reader, |
105 | 1.28M | count, |
106 | 1.28M | _marker: marker::PhantomData, |
107 | 1.28M | }) |
108 | 1.28M | } <wasmparser::readers::SectionLimited<wasmparser::readers::core::code::FunctionBody>>::new Line | Count | Source | 101 | 14.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 14.1k | let count = reader.read_var_u32()?; | 103 | 14.1k | Ok(SectionLimited { | 104 | 14.1k | reader, | 105 | 14.1k | count, | 106 | 14.1k | _marker: marker::PhantomData, | 107 | 14.1k | }) | 108 | 14.1k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHint>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHintFunction>>::new <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::new Line | Count | Source | 101 | 9.98k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 9.98k | let count = reader.read_var_u32()?; | 103 | 9.98k | Ok(SectionLimited { | 104 | 9.98k | reader, | 105 | 9.98k | count, | 106 | 9.98k | _marker: marker::PhantomData, | 107 | 9.98k | }) | 108 | 9.98k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr>>::new Line | Count | Source | 101 | 31.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 31.1k | let count = reader.read_var_u32()?; | 103 | 31.1k | Ok(SectionLimited { | 104 | 31.1k | reader, | 105 | 31.1k | count, | 106 | 31.1k | _marker: marker::PhantomData, | 107 | 31.1k | }) | 108 | 31.1k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::IndirectNaming>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::Naming>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::reloc::RelocationEntry>>::new <wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::new Line | Count | Source | 101 | 55.3k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 55.3k | let count = reader.read_var_u32()?; | 103 | 55.3k | Ok(SectionLimited { | 104 | 55.3k | reader, | 105 | 55.3k | count, | 106 | 55.3k | _marker: marker::PhantomData, | 107 | 55.3k | }) | 108 | 55.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::new Line | Count | Source | 101 | 3.08k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 3.08k | let count = reader.read_var_u32()?; | 103 | 3.08k | Ok(SectionLimited { | 104 | 3.08k | reader, | 105 | 3.08k | count, | 106 | 3.08k | _marker: marker::PhantomData, | 107 | 3.08k | }) | 108 | 3.08k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::new Line | Count | Source | 101 | 91.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 91.1k | let count = reader.read_var_u32()?; | 103 | 91.1k | Ok(SectionLimited { | 104 | 91.1k | reader, | 105 | 91.1k | count, | 106 | 91.1k | _marker: marker::PhantomData, | 107 | 91.1k | }) | 108 | 91.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::new Line | Count | Source | 101 | 20.8k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 20.8k | let count = reader.read_var_u32()?; | 103 | 20.8k | Ok(SectionLimited { | 104 | 20.8k | reader, | 105 | 20.8k | count, | 106 | 20.8k | _marker: marker::PhantomData, | 107 | 20.8k | }) | 108 | 20.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::new Line | Count | Source | 101 | 57.9k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 57.9k | let count = reader.read_var_u32()?; | 103 | 57.9k | Ok(SectionLimited { | 104 | 57.9k | reader, | 105 | 57.9k | count, | 106 | 57.9k | _marker: marker::PhantomData, | 107 | 57.9k | }) | 108 | 57.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::new Line | Count | Source | 101 | 34.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 34.1k | let count = reader.read_var_u32()?; | 103 | 34.1k | Ok(SectionLimited { | 104 | 34.1k | reader, | 105 | 34.1k | count, | 106 | 34.1k | _marker: marker::PhantomData, | 107 | 34.1k | }) | 108 | 34.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import>>::new Line | Count | Source | 101 | 53.2k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 53.2k | let count = reader.read_var_u32()?; | 103 | 53.2k | Ok(SectionLimited { | 104 | 53.2k | reader, | 105 | 53.2k | count, | 106 | 53.2k | _marker: marker::PhantomData, | 107 | 53.2k | }) | 108 | 53.2k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::linking::SymbolInfo>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::linking::ComdatSymbol>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::linking::Comdat>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::linking::Segment>>::new Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::linking::InitFunc>>::new <wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::new Line | Count | Source | 101 | 14.5k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 14.5k | let count = reader.read_var_u32()?; | 103 | 14.5k | Ok(SectionLimited { | 104 | 14.5k | reader, | 105 | 14.5k | count, | 106 | 14.5k | _marker: marker::PhantomData, | 107 | 14.5k | }) | 108 | 14.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersField>>::new Line | Count | Source | 101 | 24.9k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 24.9k | let count = reader.read_var_u32()?; | 103 | 24.9k | Ok(SectionLimited { | 104 | 24.9k | reader, | 105 | 24.9k | count, | 106 | 24.9k | _marker: marker::PhantomData, | 107 | 24.9k | }) | 108 | 24.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue>>::new Line | Count | Source | 101 | 12.4k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 12.4k | let count = reader.read_var_u32()?; | 103 | 12.4k | Ok(SectionLimited { | 104 | 12.4k | reader, | 105 | 12.4k | count, | 106 | 12.4k | _marker: marker::PhantomData, | 107 | 12.4k | }) | 108 | 12.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::new Line | Count | Source | 101 | 76.8k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 76.8k | let count = reader.read_var_u32()?; | 103 | 76.8k | Ok(SectionLimited { | 104 | 76.8k | reader, | 105 | 76.8k | count, | 106 | 76.8k | _marker: marker::PhantomData, | 107 | 76.8k | }) | 108 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::new Line | Count | Source | 101 | 260k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 260k | let count = reader.read_var_u32()?; | 103 | 260k | Ok(SectionLimited { | 104 | 260k | reader, | 105 | 260k | count, | 106 | 260k | _marker: marker::PhantomData, | 107 | 260k | }) | 108 | 260k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::new <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::new Line | Count | Source | 101 | 97.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 97.1k | let count = reader.read_var_u32()?; | 103 | 97.1k | Ok(SectionLimited { | 104 | 97.1k | reader, | 105 | 97.1k | count, | 106 | 97.1k | _marker: marker::PhantomData, | 107 | 97.1k | }) | 108 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::new Line | Count | Source | 101 | 210k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 210k | let count = reader.read_var_u32()?; | 103 | 210k | Ok(SectionLimited { | 104 | 210k | reader, | 105 | 210k | count, | 106 | 210k | _marker: marker::PhantomData, | 107 | 210k | }) | 108 | 210k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::new Line | Count | Source | 101 | 54.6k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 54.6k | let count = reader.read_var_u32()?; | 103 | 54.6k | Ok(SectionLimited { | 104 | 54.6k | reader, | 105 | 54.6k | count, | 106 | 54.6k | _marker: marker::PhantomData, | 107 | 54.6k | }) | 108 | 54.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::new Line | Count | Source | 101 | 19.3k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 19.3k | let count = reader.read_var_u32()?; | 103 | 19.3k | Ok(SectionLimited { | 104 | 19.3k | reader, | 105 | 19.3k | count, | 106 | 19.3k | _marker: marker::PhantomData, | 107 | 19.3k | }) | 108 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::new Line | Count | Source | 101 | 37.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 37.1k | let count = reader.read_var_u32()?; | 103 | 37.1k | Ok(SectionLimited { | 104 | 37.1k | reader, | 105 | 37.1k | count, | 106 | 37.1k | _marker: marker::PhantomData, | 107 | 37.1k | }) | 108 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32>>::new Line | Count | Source | 101 | 108k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 108k | let count = reader.read_var_u32()?; | 103 | 108k | Ok(SectionLimited { | 104 | 108k | reader, | 105 | 108k | count, | 106 | 108k | _marker: marker::PhantomData, | 107 | 108k | }) | 108 | 108k | } |
|
109 | | |
110 | | /// Returns the count of total items within this section. |
111 | 997k | pub fn count(&self) -> u32 { |
112 | 997k | self.count |
113 | 997k | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHint>>::count <wasmparser::readers::SectionLimited<wasmparser::readers::core::code::FunctionBody>>::count Line | Count | Source | 111 | 1.53k | pub fn count(&self) -> u32 { | 112 | 1.53k | self.count | 113 | 1.53k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::count Line | Count | Source | 111 | 6.44k | pub fn count(&self) -> u32 { | 112 | 6.44k | self.count | 113 | 6.44k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr>>::count Line | Count | Source | 111 | 17.2k | pub fn count(&self) -> u32 { | 112 | 17.2k | self.count | 113 | 17.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::count Line | Count | Source | 111 | 30.7k | pub fn count(&self) -> u32 { | 112 | 30.7k | self.count | 113 | 30.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::count Line | Count | Source | 111 | 578 | pub fn count(&self) -> u32 { | 112 | 578 | self.count | 113 | 578 | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::count Line | Count | Source | 111 | 56.7k | pub fn count(&self) -> u32 { | 112 | 56.7k | self.count | 113 | 56.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::count Line | Count | Source | 111 | 15.0k | pub fn count(&self) -> u32 { | 112 | 15.0k | self.count | 113 | 15.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::count Line | Count | Source | 111 | 33.3k | pub fn count(&self) -> u32 { | 112 | 33.3k | self.count | 113 | 33.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::count Line | Count | Source | 111 | 14.5k | pub fn count(&self) -> u32 { | 112 | 14.5k | self.count | 113 | 14.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import>>::count Line | Count | Source | 111 | 34.9k | pub fn count(&self) -> u32 { | 112 | 34.9k | self.count | 113 | 34.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::count Line | Count | Source | 111 | 10.9k | pub fn count(&self) -> u32 { | 112 | 10.9k | self.count | 113 | 10.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::count Line | Count | Source | 111 | 76.8k | pub fn count(&self) -> u32 { | 112 | 76.8k | self.count | 113 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::count Line | Count | Source | 111 | 235k | pub fn count(&self) -> u32 { | 112 | 235k | self.count | 113 | 235k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::count <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::count Line | Count | Source | 111 | 97.1k | pub fn count(&self) -> u32 { | 112 | 97.1k | self.count | 113 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::count Line | Count | Source | 111 | 185k | pub fn count(&self) -> u32 { | 112 | 185k | self.count | 113 | 185k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::count Line | Count | Source | 111 | 54.6k | pub fn count(&self) -> u32 { | 112 | 54.6k | self.count | 113 | 54.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::count Line | Count | Source | 111 | 19.3k | pub fn count(&self) -> u32 { | 112 | 19.3k | self.count | 113 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::count Line | Count | Source | 111 | 37.1k | pub fn count(&self) -> u32 { | 112 | 37.1k | self.count | 113 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32>>::count Line | Count | Source | 111 | 68.4k | pub fn count(&self) -> u32 { | 112 | 68.4k | self.count | 113 | 68.4k | } |
|
114 | | |
115 | | /// Returns whether the original byte offset of this section. |
116 | 0 | pub fn original_position(&self) -> usize { |
117 | 0 | self.reader.original_position() |
118 | 0 | } |
119 | | |
120 | | /// Returns the range, as byte offsets, of this section within the original |
121 | | /// wasm binary. |
122 | 1.04M | pub fn range(&self) -> Range<usize> { |
123 | 1.04M | self.reader.range() |
124 | 1.04M | } <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::range Line | Count | Source | 122 | 6.45k | pub fn range(&self) -> Range<usize> { | 123 | 6.45k | self.reader.range() | 124 | 6.45k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::range Line | Count | Source | 122 | 49.5k | pub fn range(&self) -> Range<usize> { | 123 | 49.5k | self.reader.range() | 124 | 49.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::range Line | Count | Source | 122 | 621 | pub fn range(&self) -> Range<usize> { | 123 | 621 | self.reader.range() | 124 | 621 | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::range Line | Count | Source | 122 | 79.3k | pub fn range(&self) -> Range<usize> { | 123 | 79.3k | self.reader.range() | 124 | 79.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::range Line | Count | Source | 122 | 15.1k | pub fn range(&self) -> Range<usize> { | 123 | 15.1k | self.reader.range() | 124 | 15.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::range Line | Count | Source | 122 | 52.1k | pub fn range(&self) -> Range<usize> { | 123 | 52.1k | self.reader.range() | 124 | 52.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::range Line | Count | Source | 122 | 17.1k | pub fn range(&self) -> Range<usize> { | 123 | 17.1k | self.reader.range() | 124 | 17.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import>>::range Line | Count | Source | 122 | 46.1k | pub fn range(&self) -> Range<usize> { | 123 | 46.1k | self.reader.range() | 124 | 46.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::range Line | Count | Source | 122 | 10.9k | pub fn range(&self) -> Range<usize> { | 123 | 10.9k | self.reader.range() | 124 | 10.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::range Line | Count | Source | 122 | 76.8k | pub fn range(&self) -> Range<usize> { | 123 | 76.8k | self.reader.range() | 124 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::range Line | Count | Source | 122 | 235k | pub fn range(&self) -> Range<usize> { | 123 | 235k | self.reader.range() | 124 | 235k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::range <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::range Line | Count | Source | 122 | 97.1k | pub fn range(&self) -> Range<usize> { | 123 | 97.1k | self.reader.range() | 124 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::range Line | Count | Source | 122 | 185k | pub fn range(&self) -> Range<usize> { | 123 | 185k | self.reader.range() | 124 | 185k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::range Line | Count | Source | 122 | 54.6k | pub fn range(&self) -> Range<usize> { | 123 | 54.6k | self.reader.range() | 124 | 54.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::range Line | Count | Source | 122 | 19.3k | pub fn range(&self) -> Range<usize> { | 123 | 19.3k | self.reader.range() | 124 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::range Line | Count | Source | 122 | 37.1k | pub fn range(&self) -> Range<usize> { | 123 | 37.1k | self.reader.range() | 124 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32>>::range Line | Count | Source | 122 | 60.5k | pub fn range(&self) -> Range<usize> { | 123 | 60.5k | self.reader.range() | 124 | 60.5k | } |
|
125 | | |
126 | | /// Returns an iterator which yields not only each item in this section but |
127 | | /// additionally the offset of each item within the section. |
128 | 993k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> |
129 | 993k | where |
130 | 993k | T: FromReader<'a>, |
131 | 993k | { |
132 | 993k | SectionLimitedIntoIterWithOffsets { |
133 | 993k | iter: self.into_iter(), |
134 | 993k | } |
135 | 993k | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHint>>::into_iter_with_offsets Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue>>::into_iter_with_offsets <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::into_iter_with_offsets Line | Count | Source | 128 | 6.87k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 6.87k | where | 130 | 6.87k | T: FromReader<'a>, | 131 | 6.87k | { | 132 | 6.87k | SectionLimitedIntoIterWithOffsets { | 133 | 6.87k | iter: self.into_iter(), | 134 | 6.87k | } | 135 | 6.87k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::into_iter_with_offsets Line | Count | Source | 128 | 31.4k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 31.4k | where | 130 | 31.4k | T: FromReader<'a>, | 131 | 31.4k | { | 132 | 31.4k | SectionLimitedIntoIterWithOffsets { | 133 | 31.4k | iter: self.into_iter(), | 134 | 31.4k | } | 135 | 31.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::into_iter_with_offsets Line | Count | Source | 128 | 1.69k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 1.69k | where | 130 | 1.69k | T: FromReader<'a>, | 131 | 1.69k | { | 132 | 1.69k | SectionLimitedIntoIterWithOffsets { | 133 | 1.69k | iter: self.into_iter(), | 134 | 1.69k | } | 135 | 1.69k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::into_iter_with_offsets Line | Count | Source | 128 | 65.4k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 65.4k | where | 130 | 65.4k | T: FromReader<'a>, | 131 | 65.4k | { | 132 | 65.4k | SectionLimitedIntoIterWithOffsets { | 133 | 65.4k | iter: self.into_iter(), | 134 | 65.4k | } | 135 | 65.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::into_iter_with_offsets Line | Count | Source | 128 | 15.8k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 15.8k | where | 130 | 15.8k | T: FromReader<'a>, | 131 | 15.8k | { | 132 | 15.8k | SectionLimitedIntoIterWithOffsets { | 133 | 15.8k | iter: self.into_iter(), | 134 | 15.8k | } | 135 | 15.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::into_iter_with_offsets Line | Count | Source | 128 | 34.2k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 34.2k | where | 130 | 34.2k | T: FromReader<'a>, | 131 | 34.2k | { | 132 | 34.2k | SectionLimitedIntoIterWithOffsets { | 133 | 34.2k | iter: self.into_iter(), | 134 | 34.2k | } | 135 | 34.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::into_iter_with_offsets Line | Count | Source | 128 | 18.1k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 18.1k | where | 130 | 18.1k | T: FromReader<'a>, | 131 | 18.1k | { | 132 | 18.1k | SectionLimitedIntoIterWithOffsets { | 133 | 18.1k | iter: self.into_iter(), | 134 | 18.1k | } | 135 | 18.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import>>::into_iter_with_offsets Line | Count | Source | 128 | 37.6k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 37.6k | where | 130 | 37.6k | T: FromReader<'a>, | 131 | 37.6k | { | 132 | 37.6k | SectionLimitedIntoIterWithOffsets { | 133 | 37.6k | iter: self.into_iter(), | 134 | 37.6k | } | 135 | 37.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::into_iter_with_offsets Line | Count | Source | 128 | 11.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 11.3k | where | 130 | 11.3k | T: FromReader<'a>, | 131 | 11.3k | { | 132 | 11.3k | SectionLimitedIntoIterWithOffsets { | 133 | 11.3k | iter: self.into_iter(), | 134 | 11.3k | } | 135 | 11.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::into_iter_with_offsets Line | Count | Source | 128 | 76.8k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 76.8k | where | 130 | 76.8k | T: FromReader<'a>, | 131 | 76.8k | { | 132 | 76.8k | SectionLimitedIntoIterWithOffsets { | 133 | 76.8k | iter: self.into_iter(), | 134 | 76.8k | } | 135 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::into_iter_with_offsets Line | Count | Source | 128 | 235k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 235k | where | 130 | 235k | T: FromReader<'a>, | 131 | 235k | { | 132 | 235k | SectionLimitedIntoIterWithOffsets { | 133 | 235k | iter: self.into_iter(), | 134 | 235k | } | 135 | 235k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::into_iter_with_offsets <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::into_iter_with_offsets Line | Count | Source | 128 | 97.1k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 97.1k | where | 130 | 97.1k | T: FromReader<'a>, | 131 | 97.1k | { | 132 | 97.1k | SectionLimitedIntoIterWithOffsets { | 133 | 97.1k | iter: self.into_iter(), | 134 | 97.1k | } | 135 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::into_iter_with_offsets Line | Count | Source | 128 | 185k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 185k | where | 130 | 185k | T: FromReader<'a>, | 131 | 185k | { | 132 | 185k | SectionLimitedIntoIterWithOffsets { | 133 | 185k | iter: self.into_iter(), | 134 | 185k | } | 135 | 185k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::into_iter_with_offsets Line | Count | Source | 128 | 54.6k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 54.6k | where | 130 | 54.6k | T: FromReader<'a>, | 131 | 54.6k | { | 132 | 54.6k | SectionLimitedIntoIterWithOffsets { | 133 | 54.6k | iter: self.into_iter(), | 134 | 54.6k | } | 135 | 54.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::into_iter_with_offsets Line | Count | Source | 128 | 19.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 19.3k | where | 130 | 19.3k | T: FromReader<'a>, | 131 | 19.3k | { | 132 | 19.3k | SectionLimitedIntoIterWithOffsets { | 133 | 19.3k | iter: self.into_iter(), | 134 | 19.3k | } | 135 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::into_iter_with_offsets Line | Count | Source | 128 | 37.1k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 37.1k | where | 130 | 37.1k | T: FromReader<'a>, | 131 | 37.1k | { | 132 | 37.1k | SectionLimitedIntoIterWithOffsets { | 133 | 37.1k | iter: self.into_iter(), | 134 | 37.1k | } | 135 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32>>::into_iter_with_offsets Line | Count | Source | 128 | 64.7k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 64.7k | where | 130 | 64.7k | T: FromReader<'a>, | 131 | 64.7k | { | 132 | 64.7k | SectionLimitedIntoIterWithOffsets { | 133 | 64.7k | iter: self.into_iter(), | 134 | 64.7k | } | 135 | 64.7k | } |
|
136 | | } |
137 | | |
138 | | impl<T> Clone for SectionLimited<'_, T> { |
139 | 942k | fn clone(&self) -> Self { |
140 | 942k | SectionLimited { |
141 | 942k | reader: self.reader.clone(), |
142 | 942k | count: self.count, |
143 | 942k | _marker: self._marker, |
144 | 942k | } |
145 | 942k | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::IndirectNaming> as core::clone::Clone>::clone Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::Naming> as core::clone::Clone>::clone <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data> as core::clone::Clone>::clone Line | Count | Source | 139 | 5.41k | fn clone(&self) -> Self { | 140 | 5.41k | SectionLimited { | 141 | 5.41k | reader: self.reader.clone(), | 142 | 5.41k | count: self.count, | 143 | 5.41k | _marker: self._marker, | 144 | 5.41k | } | 145 | 5.41k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::reloc::RelocationEntry> as core::clone::Clone>::clone <wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType> as core::clone::Clone>::clone Line | Count | Source | 139 | 29.0k | fn clone(&self) -> Self { | 140 | 29.0k | SectionLimited { | 141 | 29.0k | reader: self.reader.clone(), | 142 | 29.0k | count: self.count, | 143 | 29.0k | _marker: self._marker, | 144 | 29.0k | } | 145 | 29.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType> as core::clone::Clone>::clone Line | Count | Source | 139 | 578 | fn clone(&self) -> Self { | 140 | 578 | SectionLimited { | 141 | 578 | reader: self.reader.clone(), | 142 | 578 | count: self.count, | 143 | 578 | _marker: self._marker, | 144 | 578 | } | 145 | 578 | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup> as core::clone::Clone>::clone Line | Count | Source | 139 | 56.5k | fn clone(&self) -> Self { | 140 | 56.5k | SectionLimited { | 141 | 56.5k | reader: self.reader.clone(), | 142 | 56.5k | count: self.count, | 143 | 56.5k | _marker: self._marker, | 144 | 56.5k | } | 145 | 56.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table> as core::clone::Clone>::clone Line | Count | Source | 139 | 13.3k | fn clone(&self) -> Self { | 140 | 13.3k | SectionLimited { | 141 | 13.3k | reader: self.reader.clone(), | 142 | 13.3k | count: self.count, | 143 | 13.3k | _marker: self._marker, | 144 | 13.3k | } | 145 | 13.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export> as core::clone::Clone>::clone Line | Count | Source | 139 | 33.2k | fn clone(&self) -> Self { | 140 | 33.2k | SectionLimited { | 141 | 33.2k | reader: self.reader.clone(), | 142 | 33.2k | count: self.count, | 143 | 33.2k | _marker: self._marker, | 144 | 33.2k | } | 145 | 33.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global> as core::clone::Clone>::clone Line | Count | Source | 139 | 14.4k | fn clone(&self) -> Self { | 140 | 14.4k | SectionLimited { | 141 | 14.4k | reader: self.reader.clone(), | 142 | 14.4k | count: self.count, | 143 | 14.4k | _marker: self._marker, | 144 | 14.4k | } | 145 | 14.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import> as core::clone::Clone>::clone Line | Count | Source | 139 | 34.8k | fn clone(&self) -> Self { | 140 | 34.8k | SectionLimited { | 141 | 34.8k | reader: self.reader.clone(), | 142 | 34.8k | count: self.count, | 143 | 34.8k | _marker: self._marker, | 144 | 34.8k | } | 145 | 34.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element> as core::clone::Clone>::clone Line | Count | Source | 139 | 9.87k | fn clone(&self) -> Self { | 140 | 9.87k | SectionLimited { | 141 | 9.87k | reader: self.reader.clone(), | 142 | 9.87k | count: self.count, | 143 | 9.87k | _marker: self._marker, | 144 | 9.87k | } | 145 | 9.87k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction> as core::clone::Clone>::clone Line | Count | Source | 139 | 76.8k | fn clone(&self) -> Self { | 140 | 76.8k | SectionLimited { | 141 | 76.8k | reader: self.reader.clone(), | 142 | 76.8k | count: self.count, | 143 | 76.8k | _marker: self._marker, | 144 | 76.8k | } | 145 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType> as core::clone::Clone>::clone Line | Count | Source | 139 | 235k | fn clone(&self) -> Self { | 140 | 235k | SectionLimited { | 141 | 235k | reader: self.reader.clone(), | 142 | 235k | count: self.count, | 143 | 235k | _marker: self._marker, | 144 | 235k | } | 145 | 235k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType> as core::clone::Clone>::clone <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias> as core::clone::Clone>::clone Line | Count | Source | 139 | 97.1k | fn clone(&self) -> Self { | 140 | 97.1k | SectionLimited { | 141 | 97.1k | reader: self.reader.clone(), | 142 | 97.1k | count: self.count, | 143 | 97.1k | _marker: self._marker, | 144 | 97.1k | } | 145 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport> as core::clone::Clone>::clone Line | Count | Source | 139 | 185k | fn clone(&self) -> Self { | 140 | 185k | SectionLimited { | 141 | 185k | reader: self.reader.clone(), | 142 | 185k | count: self.count, | 143 | 185k | _marker: self._marker, | 144 | 185k | } | 145 | 185k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport> as core::clone::Clone>::clone Line | Count | Source | 139 | 54.6k | fn clone(&self) -> Self { | 140 | 54.6k | SectionLimited { | 141 | 54.6k | reader: self.reader.clone(), | 142 | 54.6k | count: self.count, | 143 | 54.6k | _marker: self._marker, | 144 | 54.6k | } | 145 | 54.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance> as core::clone::Clone>::clone Line | Count | Source | 139 | 19.3k | fn clone(&self) -> Self { | 140 | 19.3k | SectionLimited { | 141 | 19.3k | reader: self.reader.clone(), | 142 | 19.3k | count: self.count, | 143 | 19.3k | _marker: self._marker, | 144 | 19.3k | } | 145 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance> as core::clone::Clone>::clone Line | Count | Source | 139 | 37.1k | fn clone(&self) -> Self { | 140 | 37.1k | SectionLimited { | 141 | 37.1k | reader: self.reader.clone(), | 142 | 37.1k | count: self.count, | 143 | 37.1k | _marker: self._marker, | 144 | 37.1k | } | 145 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32> as core::clone::Clone>::clone Line | Count | Source | 139 | 38.9k | fn clone(&self) -> Self { | 140 | 38.9k | SectionLimited { | 141 | 38.9k | reader: self.reader.clone(), | 142 | 38.9k | count: self.count, | 143 | 38.9k | _marker: self._marker, | 144 | 38.9k | } | 145 | 38.9k | } |
|
146 | | } |
147 | | |
148 | | impl<T> fmt::Debug for SectionLimited<'_, T> { |
149 | 0 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
150 | 0 | f.debug_struct("SectionLimited") |
151 | 0 | .field("count", &self.count) |
152 | 0 | .field("range", &self.range()) |
153 | 0 | .finish() |
154 | 0 | } |
155 | | } |
156 | | |
157 | | impl<'a, T> IntoIterator for SectionLimited<'a, T> |
158 | | where |
159 | | T: FromReader<'a>, |
160 | | { |
161 | | type Item = Result<T>; |
162 | | type IntoIter = SectionLimitedIntoIter<'a, T>; |
163 | | |
164 | 1.19M | fn into_iter(self) -> Self::IntoIter { |
165 | 1.19M | SectionLimitedIntoIter { |
166 | 1.19M | remaining: self.count, |
167 | 1.19M | section: self, |
168 | 1.19M | end: false, |
169 | 1.19M | } |
170 | 1.19M | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHintFunction> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::Naming> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::collect::IntoIterator>::into_iter <wasmparser::readers::SectionLimited<wasmparser::readers::core::code::FunctionBody> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 14.0k | fn into_iter(self) -> Self::IntoIter { | 165 | 14.0k | SectionLimitedIntoIter { | 166 | 14.0k | remaining: self.count, | 167 | 14.0k | section: self, | 168 | 14.0k | end: false, | 169 | 14.0k | } | 170 | 14.0k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::Naming> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::collect::IntoIterator>::into_iter Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::names::Naming> as core::iter::traits::collect::IntoIterator>::into_iter <wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 12.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 12.4k | SectionLimitedIntoIter { | 166 | 12.4k | remaining: self.count, | 167 | 12.4k | section: self, | 168 | 12.4k | end: false, | 169 | 12.4k | } | 170 | 12.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 12.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 12.4k | SectionLimitedIntoIter { | 166 | 12.4k | remaining: self.count, | 167 | 12.4k | section: self, | 168 | 12.4k | end: false, | 169 | 12.4k | } | 170 | 12.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 7.50k | fn into_iter(self) -> Self::IntoIter { | 165 | 7.50k | SectionLimitedIntoIter { | 166 | 7.50k | remaining: self.count, | 167 | 7.50k | section: self, | 168 | 7.50k | end: false, | 169 | 7.50k | } | 170 | 7.50k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 31.0k | fn into_iter(self) -> Self::IntoIter { | 165 | 31.0k | SectionLimitedIntoIter { | 166 | 31.0k | remaining: self.count, | 167 | 31.0k | section: self, | 168 | 31.0k | end: false, | 169 | 31.0k | } | 170 | 31.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 34.1k | fn into_iter(self) -> Self::IntoIter { | 165 | 34.1k | SectionLimitedIntoIter { | 166 | 34.1k | remaining: self.count, | 167 | 34.1k | section: self, | 168 | 34.1k | end: false, | 169 | 34.1k | } | 170 | 34.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 1.85k | fn into_iter(self) -> Self::IntoIter { | 165 | 1.85k | SectionLimitedIntoIter { | 166 | 1.85k | remaining: self.count, | 167 | 1.85k | section: self, | 168 | 1.85k | end: false, | 169 | 1.85k | } | 170 | 1.85k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 67.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 67.4k | SectionLimitedIntoIter { | 166 | 67.4k | remaining: self.count, | 167 | 67.4k | section: self, | 168 | 67.4k | end: false, | 169 | 67.4k | } | 170 | 67.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 18.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 18.3k | SectionLimitedIntoIter { | 166 | 18.3k | remaining: self.count, | 167 | 18.3k | section: self, | 168 | 18.3k | end: false, | 169 | 18.3k | } | 170 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 43.0k | fn into_iter(self) -> Self::IntoIter { | 165 | 43.0k | SectionLimitedIntoIter { | 166 | 43.0k | remaining: self.count, | 167 | 43.0k | section: self, | 168 | 43.0k | end: false, | 169 | 43.0k | } | 170 | 43.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 30.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 30.3k | SectionLimitedIntoIter { | 166 | 30.3k | remaining: self.count, | 167 | 30.3k | section: self, | 168 | 30.3k | end: false, | 169 | 30.3k | } | 170 | 30.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Import> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 44.2k | fn into_iter(self) -> Self::IntoIter { | 165 | 44.2k | SectionLimitedIntoIter { | 166 | 44.2k | remaining: self.count, | 167 | 44.2k | section: self, | 168 | 44.2k | end: false, | 169 | 44.2k | } | 170 | 44.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 11.9k | fn into_iter(self) -> Self::IntoIter { | 165 | 11.9k | SectionLimitedIntoIter { | 166 | 11.9k | remaining: self.count, | 167 | 11.9k | section: self, | 168 | 11.9k | end: false, | 169 | 11.9k | } | 170 | 11.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 76.8k | fn into_iter(self) -> Self::IntoIter { | 165 | 76.8k | SectionLimitedIntoIter { | 166 | 76.8k | remaining: self.count, | 167 | 76.8k | section: self, | 168 | 76.8k | end: false, | 169 | 76.8k | } | 170 | 76.8k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 235k | fn into_iter(self) -> Self::IntoIter { | 165 | 235k | SectionLimitedIntoIter { | 166 | 235k | remaining: self.count, | 167 | 235k | section: self, | 168 | 235k | end: false, | 169 | 235k | } | 170 | 235k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType> as core::iter::traits::collect::IntoIterator>::into_iter <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 97.1k | fn into_iter(self) -> Self::IntoIter { | 165 | 97.1k | SectionLimitedIntoIter { | 166 | 97.1k | remaining: self.count, | 167 | 97.1k | section: self, | 168 | 97.1k | end: false, | 169 | 97.1k | } | 170 | 97.1k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 247k | fn into_iter(self) -> Self::IntoIter { | 165 | 247k | SectionLimitedIntoIter { | 166 | 247k | remaining: self.count, | 167 | 247k | section: self, | 168 | 247k | end: false, | 169 | 247k | } | 170 | 247k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 66.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 66.4k | SectionLimitedIntoIter { | 166 | 66.4k | remaining: self.count, | 167 | 66.4k | section: self, | 168 | 66.4k | end: false, | 169 | 66.4k | } | 170 | 66.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 19.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 19.3k | SectionLimitedIntoIter { | 166 | 19.3k | remaining: self.count, | 167 | 19.3k | section: self, | 168 | 19.3k | end: false, | 169 | 19.3k | } | 170 | 19.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 37.1k | fn into_iter(self) -> Self::IntoIter { | 165 | 37.1k | SectionLimitedIntoIter { | 166 | 37.1k | remaining: self.count, | 167 | 37.1k | section: self, | 168 | 37.1k | end: false, | 169 | 37.1k | } | 170 | 37.1k | } |
<wasmparser::readers::SectionLimited<u32> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 85.6k | fn into_iter(self) -> Self::IntoIter { | 165 | 85.6k | SectionLimitedIntoIter { | 166 | 85.6k | remaining: self.count, | 167 | 85.6k | section: self, | 168 | 85.6k | end: false, | 169 | 85.6k | } | 170 | 85.6k | } |
|
171 | | } |
172 | | |
173 | | /// A consuming iterator of a [`SectionLimited`]. |
174 | | /// |
175 | | /// This is created via the [`IntoIterator`] `impl` for the [`SectionLimited`] |
176 | | /// type. |
177 | | pub struct SectionLimitedIntoIter<'a, T> { |
178 | | section: SectionLimited<'a, T>, |
179 | | remaining: u32, |
180 | | end: bool, |
181 | | } |
182 | | |
183 | | impl<T> SectionLimitedIntoIter<'_, T> { |
184 | | /// Returns the current byte offset of the section within this iterator. |
185 | 0 | pub fn original_position(&self) -> usize { |
186 | 0 | self.section.reader.original_position() |
187 | 0 | } |
188 | | } |
189 | | |
190 | | impl<'a, T> Iterator for SectionLimitedIntoIter<'a, T> |
191 | | where |
192 | | T: FromReader<'a>, |
193 | | { |
194 | | type Item = Result<T>; |
195 | | |
196 | 5.52M | fn next(&mut self) -> Option<Result<T>> { |
197 | 5.52M | if self.end { |
198 | 0 | return None; |
199 | 5.52M | } |
200 | 5.52M | if self.remaining == 0 { |
201 | 1.19M | self.end = true; |
202 | 1.19M | if self.section.reader.eof() { |
203 | 1.19M | return None; |
204 | 0 | } |
205 | 0 | return Some(Err(BinaryReaderError::new( |
206 | 0 | "section size mismatch: unexpected data at the end of the section", |
207 | 0 | self.section.reader.original_position(), |
208 | 0 | ))); |
209 | 4.32M | } |
210 | 4.32M | let result = self.section.reader.read(); |
211 | 4.32M | self.end = result.is_err(); |
212 | 4.32M | self.remaining -= 1; |
213 | 4.32M | Some(result) |
214 | 5.52M | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::branch_hinting::BranchHintFunction> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::Naming> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::code::FunctionBody> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 179k | fn next(&mut self) -> Option<Result<T>> { | 197 | 179k | if self.end { | 198 | 0 | return None; | 199 | 179k | } | 200 | 179k | if self.remaining == 0 { | 201 | 14.0k | self.end = true; | 202 | 14.0k | if self.section.reader.eof() { | 203 | 14.0k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 165k | } | 210 | 165k | let result = self.section.reader.read(); | 211 | 165k | self.end = result.is_err(); | 212 | 165k | self.remaining -= 1; | 213 | 165k | Some(result) | 214 | 179k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::Naming> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::IndirectNaming> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::Naming> as core::iter::traits::iterator::Iterator>::next <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 24.9k | fn next(&mut self) -> Option<Result<T>> { | 197 | 24.9k | if self.end { | 198 | 0 | return None; | 199 | 24.9k | } | 200 | 24.9k | if self.remaining == 0 { | 201 | 12.4k | self.end = true; | 202 | 12.4k | if self.section.reader.eof() { | 203 | 12.4k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 12.4k | } | 210 | 12.4k | let result = self.section.reader.read(); | 211 | 12.4k | self.end = result.is_err(); | 212 | 12.4k | self.remaining -= 1; | 213 | 12.4k | Some(result) | 214 | 24.9k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 24.9k | fn next(&mut self) -> Option<Result<T>> { | 197 | 24.9k | if self.end { | 198 | 0 | return None; | 199 | 24.9k | } | 200 | 24.9k | if self.remaining == 0 { | 201 | 12.4k | self.end = true; | 202 | 12.4k | if self.section.reader.eof() { | 203 | 12.4k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 12.4k | } | 210 | 12.4k | let result = self.section.reader.read(); | 211 | 12.4k | self.end = result.is_err(); | 212 | 12.4k | self.remaining -= 1; | 213 | 12.4k | Some(result) | 214 | 24.9k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::data::Data> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 57.7k | fn next(&mut self) -> Option<Result<T>> { | 197 | 57.7k | if self.end { | 198 | 0 | return None; | 199 | 57.7k | } | 200 | 57.7k | if self.remaining == 0 { | 201 | 7.50k | self.end = true; | 202 | 7.50k | if self.section.reader.eof() { | 203 | 7.50k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 50.2k | } | 210 | 50.2k | let result = self.section.reader.read(); | 211 | 50.2k | self.end = result.is_err(); | 212 | 50.2k | self.remaining -= 1; | 213 | 50.2k | Some(result) | 214 | 57.7k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::init::ConstExpr> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 481k | fn next(&mut self) -> Option<Result<T>> { | 197 | 481k | if self.end { | 198 | 0 | return None; | 199 | 481k | } | 200 | 481k | if self.remaining == 0 { | 201 | 31.0k | self.end = true; | 202 | 31.0k | if self.section.reader.eof() { | 203 | 31.0k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 450k | } | 210 | 450k | let result = self.section.reader.read(); | 211 | 450k | self.end = result.is_err(); | 212 | 450k | self.remaining -= 1; | 213 | 450k | Some(result) | 214 | 481k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::MemoryType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 147k | fn next(&mut self) -> Option<Result<T>> { | 197 | 147k | if self.end { | 198 | 0 | return None; | 199 | 147k | } | 200 | 147k | if self.remaining == 0 { | 201 | 34.1k | self.end = true; | 202 | 34.1k | if self.section.reader.eof() { | 203 | 34.1k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 112k | } | 210 | 112k | let result = self.section.reader.read(); | 211 | 112k | self.end = result.is_err(); | 212 | 112k | self.remaining -= 1; | 213 | 112k | Some(result) | 214 | 147k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::TagType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 45.5k | fn next(&mut self) -> Option<Result<T>> { | 197 | 45.5k | if self.end { | 198 | 0 | return None; | 199 | 45.5k | } | 200 | 45.5k | if self.remaining == 0 { | 201 | 1.85k | self.end = true; | 202 | 1.85k | if self.section.reader.eof() { | 203 | 1.85k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 43.7k | } | 210 | 43.7k | let result = self.section.reader.read(); | 211 | 43.7k | self.end = result.is_err(); | 212 | 43.7k | self.remaining -= 1; | 213 | 43.7k | Some(result) | 214 | 45.5k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 427k | fn next(&mut self) -> Option<Result<T>> { | 197 | 427k | if self.end { | 198 | 0 | return None; | 199 | 427k | } | 200 | 427k | if self.remaining == 0 { | 201 | 66.7k | self.end = true; | 202 | 66.7k | if self.section.reader.eof() { | 203 | 66.7k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 360k | } | 210 | 360k | let result = self.section.reader.read(); | 211 | 360k | self.end = result.is_err(); | 212 | 360k | self.remaining -= 1; | 213 | 360k | Some(result) | 214 | 427k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::tables::Table> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 83.1k | fn next(&mut self) -> Option<Result<T>> { | 197 | 83.1k | if self.end { | 198 | 0 | return None; | 199 | 83.1k | } | 200 | 83.1k | if self.remaining == 0 { | 201 | 18.3k | self.end = true; | 202 | 18.3k | if self.section.reader.eof() { | 203 | 18.3k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 64.8k | } | 210 | 64.8k | let result = self.section.reader.read(); | 211 | 64.8k | self.end = result.is_err(); | 212 | 64.8k | self.remaining -= 1; | 213 | 64.8k | Some(result) | 214 | 83.1k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 478k | fn next(&mut self) -> Option<Result<T>> { | 197 | 478k | if self.end { | 198 | 0 | return None; | 199 | 478k | } | 200 | 478k | if self.remaining == 0 { | 201 | 43.0k | self.end = true; | 202 | 43.0k | if self.section.reader.eof() { | 203 | 43.0k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 435k | } | 210 | 435k | let result = self.section.reader.read(); | 211 | 435k | self.end = result.is_err(); | 212 | 435k | self.remaining -= 1; | 213 | 435k | Some(result) | 214 | 478k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::globals::Global> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 276k | fn next(&mut self) -> Option<Result<T>> { | 197 | 276k | if self.end { | 198 | 0 | return None; | 199 | 276k | } | 200 | 276k | if self.remaining == 0 { | 201 | 30.3k | self.end = true; | 202 | 30.3k | if self.section.reader.eof() { | 203 | 30.3k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 245k | } | 210 | 245k | let result = self.section.reader.read(); | 211 | 245k | self.end = result.is_err(); | 212 | 245k | self.remaining -= 1; | 213 | 245k | Some(result) | 214 | 276k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::imports::Import> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 438k | fn next(&mut self) -> Option<Result<T>> { | 197 | 438k | if self.end { | 198 | 0 | return None; | 199 | 438k | } | 200 | 438k | if self.remaining == 0 { | 201 | 44.1k | self.end = true; | 202 | 44.1k | if self.section.reader.eof() { | 203 | 44.1k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 394k | } | 210 | 394k | let result = self.section.reader.read(); | 211 | 394k | self.end = result.is_err(); | 212 | 394k | self.remaining -= 1; | 213 | 394k | Some(result) | 214 | 438k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::elements::Element> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 81.9k | fn next(&mut self) -> Option<Result<T>> { | 197 | 81.9k | if self.end { | 198 | 0 | return None; | 199 | 81.9k | } | 200 | 81.9k | if self.remaining == 0 { | 201 | 11.9k | self.end = true; | 202 | 11.9k | if self.section.reader.eof() { | 203 | 11.9k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 69.9k | } | 210 | 69.9k | let result = self.section.reader.read(); | 211 | 69.9k | self.end = result.is_err(); | 212 | 69.9k | self.remaining -= 1; | 213 | 69.9k | Some(result) | 214 | 81.9k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 174k | fn next(&mut self) -> Option<Result<T>> { | 197 | 174k | if self.end { | 198 | 0 | return None; | 199 | 174k | } | 200 | 174k | if self.remaining == 0 { | 201 | 76.8k | self.end = true; | 202 | 76.8k | if self.section.reader.eof() { | 203 | 76.8k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 97.6k | } | 210 | 97.6k | let result = self.section.reader.read(); | 211 | 97.6k | self.end = result.is_err(); | 212 | 97.6k | self.remaining -= 1; | 213 | 97.6k | Some(result) | 214 | 174k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::types::ComponentType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 606k | fn next(&mut self) -> Option<Result<T>> { | 197 | 606k | if self.end { | 198 | 0 | return None; | 199 | 606k | } | 200 | 606k | if self.remaining == 0 { | 201 | 235k | self.end = true; | 202 | 235k | if self.section.reader.eof() { | 203 | 235k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 370k | } | 210 | 370k | let result = self.section.reader.read(); | 211 | 370k | self.end = result.is_err(); | 212 | 370k | self.remaining -= 1; | 213 | 370k | Some(result) | 214 | 606k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::types::CoreType> as core::iter::traits::iterator::Iterator>::next <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::aliases::ComponentAlias> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 270k | fn next(&mut self) -> Option<Result<T>> { | 197 | 270k | if self.end { | 198 | 0 | return None; | 199 | 270k | } | 200 | 270k | if self.remaining == 0 { | 201 | 97.1k | self.end = true; | 202 | 97.1k | if self.section.reader.eof() { | 203 | 97.1k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 172k | } | 210 | 172k | let result = self.section.reader.read(); | 211 | 172k | self.end = result.is_err(); | 212 | 172k | self.remaining -= 1; | 213 | 172k | Some(result) | 214 | 270k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 517k | fn next(&mut self) -> Option<Result<T>> { | 197 | 517k | if self.end { | 198 | 0 | return None; | 199 | 517k | } | 200 | 517k | if self.remaining == 0 { | 201 | 247k | self.end = true; | 202 | 247k | if self.section.reader.eof() { | 203 | 247k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 270k | } | 210 | 270k | let result = self.section.reader.read(); | 211 | 270k | self.end = result.is_err(); | 212 | 270k | self.remaining -= 1; | 213 | 270k | Some(result) | 214 | 517k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 163k | fn next(&mut self) -> Option<Result<T>> { | 197 | 163k | if self.end { | 198 | 0 | return None; | 199 | 163k | } | 200 | 163k | if self.remaining == 0 { | 201 | 66.4k | self.end = true; | 202 | 66.4k | if self.section.reader.eof() { | 203 | 66.4k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 97.2k | } | 210 | 97.2k | let result = self.section.reader.read(); | 211 | 97.2k | self.end = result.is_err(); | 212 | 97.2k | self.remaining -= 1; | 213 | 97.2k | Some(result) | 214 | 163k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 38.6k | fn next(&mut self) -> Option<Result<T>> { | 197 | 38.6k | if self.end { | 198 | 0 | return None; | 199 | 38.6k | } | 200 | 38.6k | if self.remaining == 0 { | 201 | 19.3k | self.end = true; | 202 | 19.3k | if self.section.reader.eof() { | 203 | 19.3k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 19.3k | } | 210 | 19.3k | let result = self.section.reader.read(); | 211 | 19.3k | self.end = result.is_err(); | 212 | 19.3k | self.remaining -= 1; | 213 | 19.3k | Some(result) | 214 | 38.6k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::instances::Instance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 96.5k | fn next(&mut self) -> Option<Result<T>> { | 197 | 96.5k | if self.end { | 198 | 0 | return None; | 199 | 96.5k | } | 200 | 96.5k | if self.remaining == 0 { | 201 | 37.1k | self.end = true; | 202 | 37.1k | if self.section.reader.eof() { | 203 | 37.1k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 59.4k | } | 210 | 59.4k | let result = self.section.reader.read(); | 211 | 59.4k | self.end = result.is_err(); | 212 | 59.4k | self.remaining -= 1; | 213 | 59.4k | Some(result) | 214 | 96.5k | } |
<wasmparser::readers::SectionLimitedIntoIter<u32> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 196 | 905k | fn next(&mut self) -> Option<Result<T>> { | 197 | 905k | if self.end { | 198 | 0 | return None; | 199 | 905k | } | 200 | 905k | if self.remaining == 0 { | 201 | 85.6k | self.end = true; | 202 | 85.6k | if self.section.reader.eof() { | 203 | 85.6k | return None; | 204 | 0 | } | 205 | 0 | return Some(Err(BinaryReaderError::new( | 206 | 0 | "section size mismatch: unexpected data at the end of the section", | 207 | 0 | self.section.reader.original_position(), | 208 | 0 | ))); | 209 | 819k | } | 210 | 819k | let result = self.section.reader.read(); | 211 | 819k | self.end = result.is_err(); | 212 | 819k | self.remaining -= 1; | 213 | 819k | Some(result) | 214 | 905k | } |
|
215 | | |
216 | 2.79k | fn size_hint(&self) -> (usize, Option<usize>) { |
217 | 2.79k | let remaining = self.remaining as usize; |
218 | 2.79k | (remaining, Some(remaining)) |
219 | 2.79k | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::iterator::Iterator>::size_hint <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::code::FunctionBody> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 216 | 2.79k | fn size_hint(&self) -> (usize, Option<usize>) { | 217 | 2.79k | let remaining = self.remaining as usize; | 218 | 2.79k | (remaining, Some(remaining)) | 219 | 2.79k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<_> as core::iter::traits::iterator::Iterator>::size_hint |
220 | | } |
221 | | |
222 | | impl<'a, T> ExactSizeIterator for SectionLimitedIntoIter<'a, T> where T: FromReader<'a> {} |
223 | | |
224 | | /// An iterator over a limited section iterator. |
225 | | pub struct SectionLimitedIntoIterWithOffsets<'a, T> { |
226 | | iter: SectionLimitedIntoIter<'a, T>, |
227 | | } |
228 | | |
229 | | impl<'a, T> Iterator for SectionLimitedIntoIterWithOffsets<'a, T> |
230 | | where |
231 | | T: FromReader<'a>, |
232 | | { |
233 | | type Item = Result<(usize, T)>; |
234 | | |
235 | 3.93M | fn next(&mut self) -> Option<Self::Item> { |
236 | 3.93M | let pos = self.iter.section.reader.original_position(); |
237 | 3.93M | Some(self.iter.next()?.map(|item| (pos, item))) Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::iterator::Iterator>::next::{closure#0} Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next::{closure#0} <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::data::Data> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 46.1k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::MemoryType> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 97.2k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::TagType> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 35.6k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 333k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::tables::Table> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 52.8k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 338k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::globals::Global> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 160k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::Import> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 290k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::elements::Element> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 59.3k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 97.6k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::types::ComponentType> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 370k | Some(self.iter.next()?.map(|item| (pos, item))) |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::types::CoreType> as core::iter::traits::iterator::Iterator>::next::{closure#0} <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::aliases::ComponentAlias> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 172k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 209k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 81.8k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 19.3k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::Instance> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 59.4k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<u32> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 237 | 520k | Some(self.iter.next()?.map(|item| (pos, item))) |
|
238 | 3.93M | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::data::Data> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 52.9k | fn next(&mut self) -> Option<Self::Item> { | 236 | 52.9k | let pos = self.iter.section.reader.original_position(); | 237 | 52.9k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 52.9k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::MemoryType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 128k | fn next(&mut self) -> Option<Self::Item> { | 236 | 128k | let pos = self.iter.section.reader.original_position(); | 237 | 128k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 128k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::TagType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 37.3k | fn next(&mut self) -> Option<Self::Item> { | 236 | 37.3k | let pos = self.iter.section.reader.original_position(); | 237 | 37.3k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 37.3k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 398k | fn next(&mut self) -> Option<Self::Item> { | 236 | 398k | let pos = self.iter.section.reader.original_position(); | 237 | 398k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 398k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::tables::Table> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 68.6k | fn next(&mut self) -> Option<Self::Item> { | 236 | 68.6k | let pos = self.iter.section.reader.original_position(); | 237 | 68.6k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 68.6k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 372k | fn next(&mut self) -> Option<Self::Item> { | 236 | 372k | let pos = self.iter.section.reader.original_position(); | 237 | 372k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 372k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::globals::Global> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 179k | fn next(&mut self) -> Option<Self::Item> { | 236 | 179k | let pos = self.iter.section.reader.original_position(); | 237 | 179k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 179k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::Import> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 327k | fn next(&mut self) -> Option<Self::Item> { | 236 | 327k | let pos = self.iter.section.reader.original_position(); | 237 | 327k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 327k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::elements::Element> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 70.7k | fn next(&mut self) -> Option<Self::Item> { | 236 | 70.7k | let pos = self.iter.section.reader.original_position(); | 237 | 70.7k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 70.7k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 174k | fn next(&mut self) -> Option<Self::Item> { | 236 | 174k | let pos = self.iter.section.reader.original_position(); | 237 | 174k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 174k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::types::ComponentType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 606k | fn next(&mut self) -> Option<Self::Item> { | 236 | 606k | let pos = self.iter.section.reader.original_position(); | 237 | 606k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 606k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::types::CoreType> as core::iter::traits::iterator::Iterator>::next <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::aliases::ComponentAlias> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 270k | fn next(&mut self) -> Option<Self::Item> { | 236 | 270k | let pos = self.iter.section.reader.original_position(); | 237 | 270k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 270k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 394k | fn next(&mut self) -> Option<Self::Item> { | 236 | 394k | let pos = self.iter.section.reader.original_position(); | 237 | 394k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 394k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 136k | fn next(&mut self) -> Option<Self::Item> { | 236 | 136k | let pos = self.iter.section.reader.original_position(); | 237 | 136k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 136k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 38.6k | fn next(&mut self) -> Option<Self::Item> { | 236 | 38.6k | let pos = self.iter.section.reader.original_position(); | 237 | 38.6k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 38.6k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::Instance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 96.5k | fn next(&mut self) -> Option<Self::Item> { | 236 | 96.5k | let pos = self.iter.section.reader.original_position(); | 237 | 96.5k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 96.5k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<u32> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 235 | 585k | fn next(&mut self) -> Option<Self::Item> { | 236 | 585k | let pos = self.iter.section.reader.original_position(); | 237 | 585k | Some(self.iter.next()?.map(|item| (pos, item))) | 238 | 585k | } |
|
239 | | |
240 | 0 | fn size_hint(&self) -> (usize, Option<usize>) { |
241 | 0 | self.iter.size_hint() |
242 | 0 | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::branch_hinting::BranchHint> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<_> as core::iter::traits::iterator::Iterator>::size_hint |
243 | | } |
244 | | |
245 | | impl<'a, T> ExactSizeIterator for SectionLimitedIntoIterWithOffsets<'a, T> where T: FromReader<'a> {} |
246 | | |
247 | | /// A trait implemented for subsections of another outer section. |
248 | | /// |
249 | | /// This is currently only used for subsections within custom sections, such as |
250 | | /// the `name` section of core wasm. |
251 | | /// |
252 | | /// This is used in conjunction with [`Subsections`]. |
253 | | pub trait Subsection<'a>: Sized { |
254 | | /// Converts the section identifier provided with the section contents into |
255 | | /// a typed section |
256 | | fn from_reader(id: u8, reader: BinaryReader<'a>) -> Result<Self>; |
257 | | } |
258 | | |
259 | | /// Iterator/reader over the contents of a section which is composed of |
260 | | /// subsections. |
261 | | /// |
262 | | /// This reader is used for the core `name` section, for example. This type |
263 | | /// primarily implements [`Iterator`] for advancing through the sections. |
264 | | pub struct Subsections<'a, T> { |
265 | | reader: BinaryReader<'a>, |
266 | | _marker: marker::PhantomData<T>, |
267 | | } |
268 | | |
269 | | impl<'a, T> Subsections<'a, T> { |
270 | | /// Creates a new reader for the specified section contents starting at |
271 | | /// `offset` within the original wasm file. |
272 | 0 | pub fn new(reader: BinaryReader<'a>) -> Self { |
273 | 0 | Subsections { |
274 | 0 | reader, |
275 | 0 | _marker: marker::PhantomData, |
276 | 0 | } |
277 | 0 | } Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name>>::new Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection>>::new Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::linking::Linking>>::new Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::component::names::ComponentName>>::new |
278 | | |
279 | | /// Returns whether the original byte offset of this section. |
280 | 0 | pub fn original_position(&self) -> usize { |
281 | 0 | self.reader.original_position() |
282 | 0 | } Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection>>::original_position Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::linking::Linking>>::original_position |
283 | | |
284 | | /// Returns the range, as byte offsets, of this section within the original |
285 | | /// wasm binary. |
286 | 0 | pub fn range(&self) -> Range<usize> { |
287 | 0 | self.reader.range() |
288 | 0 | } |
289 | | |
290 | 0 | fn read(&mut self) -> Result<T> |
291 | 0 | where |
292 | 0 | T: Subsection<'a>, |
293 | 0 | { |
294 | 0 | let subsection_id = self.reader.read_u7()?; |
295 | 0 | let reader = self.reader.read_reader()?; |
296 | 0 | T::from_reader(subsection_id, reader) |
297 | 0 | } Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::component::names::ComponentName>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::component::names::ComponentName>>::read Unexecuted instantiation: <wasmparser::readers::Subsections<_>>::read |
298 | | } |
299 | | |
300 | | impl<T> Clone for Subsections<'_, T> { |
301 | 0 | fn clone(&self) -> Self { |
302 | 0 | Subsections { |
303 | 0 | reader: self.reader.clone(), |
304 | 0 | _marker: self._marker, |
305 | 0 | } |
306 | 0 | } |
307 | | } |
308 | | |
309 | | impl<T> fmt::Debug for Subsections<'_, T> { |
310 | 0 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
311 | 0 | f.debug_struct("Subsections") |
312 | 0 | .field("range", &self.range()) |
313 | 0 | .finish() |
314 | 0 | } |
315 | | } |
316 | | |
317 | | impl<'a, T> Iterator for Subsections<'a, T> |
318 | | where |
319 | | T: Subsection<'a>, |
320 | | { |
321 | | type Item = Result<T>; |
322 | | |
323 | 0 | fn next(&mut self) -> Option<Result<T>> { |
324 | 0 | if self.reader.eof() { |
325 | 0 | None |
326 | | } else { |
327 | 0 | Some(self.read()) |
328 | | } |
329 | 0 | } Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::component::names::ComponentName> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::component::names::ComponentName> as core::iter::traits::iterator::Iterator>::next Unexecuted instantiation: <wasmparser::readers::Subsections<_> as core::iter::traits::iterator::Iterator>::next |
330 | | } |