/src/wasm-tools/crates/wasmparser/src/readers.rs
Line | Count | Source |
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, Error, 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 | 8.64k | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
42 | 8.64k | match reader.read_u8()? { |
43 | 8.64k | 0 => Ok(false), |
44 | 0 | 1 => Ok(true), |
45 | 0 | _ => Err(Error::new( |
46 | 0 | "invalid boolean value", |
47 | 0 | reader.original_position() - 1, |
48 | 0 | )), |
49 | | } |
50 | 8.64k | } |
51 | | } |
52 | | |
53 | | impl<'a> FromReader<'a> for u32 { |
54 | 6.02M | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
55 | 6.02M | reader.read_var_u32() |
56 | 6.02M | } |
57 | | } |
58 | | |
59 | | impl<'a> FromReader<'a> for &'a str { |
60 | 3.25M | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
61 | 3.25M | reader.read_string() |
62 | 3.25M | } |
63 | | } |
64 | | |
65 | | impl<'a, T, U> FromReader<'a> for (T, U) |
66 | | where |
67 | | T: FromReader<'a>, |
68 | | U: FromReader<'a>, |
69 | | { |
70 | 447k | fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> { |
71 | 447k | Ok((reader.read()?, reader.read()?)) |
72 | 447k | } |
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 | 967k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { |
102 | 967k | let count = reader.read_var_u32()?; |
103 | 967k | Ok(SectionLimited { |
104 | 967k | reader, |
105 | 967k | count, |
106 | 967k | _marker: marker::PhantomData, |
107 | 967k | }) |
108 | 967k | } <wasmparser::readers::SectionLimited<wasmparser::readers::core::code::FunctionBody>>::new Line | Count | Source | 101 | 6.73k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 6.73k | let count = reader.read_var_u32()?; | 103 | 6.73k | Ok(SectionLimited { | 104 | 6.73k | reader, | 105 | 6.73k | count, | 106 | 6.73k | _marker: marker::PhantomData, | 107 | 6.73k | }) | 108 | 6.73k | } |
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 | 7.15k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 7.15k | let count = reader.read_var_u32()?; | 103 | 7.15k | Ok(SectionLimited { | 104 | 7.15k | reader, | 105 | 7.15k | count, | 106 | 7.15k | _marker: marker::PhantomData, | 107 | 7.15k | }) | 108 | 7.15k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr>>::new Line | Count | Source | 101 | 80.1k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 80.1k | let count = reader.read_var_u32()?; | 103 | 80.1k | Ok(SectionLimited { | 104 | 80.1k | reader, | 105 | 80.1k | count, | 106 | 80.1k | _marker: marker::PhantomData, | 107 | 80.1k | }) | 108 | 80.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 | 38.5k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 38.5k | let count = reader.read_var_u32()?; | 103 | 38.5k | Ok(SectionLimited { | 104 | 38.5k | reader, | 105 | 38.5k | count, | 106 | 38.5k | _marker: marker::PhantomData, | 107 | 38.5k | }) | 108 | 38.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::new Line | Count | Source | 101 | 2.96k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 2.96k | let count = reader.read_var_u32()?; | 103 | 2.96k | Ok(SectionLimited { | 104 | 2.96k | reader, | 105 | 2.96k | count, | 106 | 2.96k | _marker: marker::PhantomData, | 107 | 2.96k | }) | 108 | 2.96k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::new Line | Count | Source | 101 | 63.7k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 63.7k | let count = reader.read_var_u32()?; | 103 | 63.7k | Ok(SectionLimited { | 104 | 63.7k | reader, | 105 | 63.7k | count, | 106 | 63.7k | _marker: marker::PhantomData, | 107 | 63.7k | }) | 108 | 63.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::new Line | Count | Source | 101 | 12.5k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 12.5k | let count = reader.read_var_u32()?; | 103 | 12.5k | Ok(SectionLimited { | 104 | 12.5k | reader, | 105 | 12.5k | count, | 106 | 12.5k | _marker: marker::PhantomData, | 107 | 12.5k | }) | 108 | 12.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::new Line | Count | Source | 101 | 40.0k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 40.0k | let count = reader.read_var_u32()?; | 103 | 40.0k | Ok(SectionLimited { | 104 | 40.0k | reader, | 105 | 40.0k | count, | 106 | 40.0k | _marker: marker::PhantomData, | 107 | 40.0k | }) | 108 | 40.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::new Line | Count | Source | 101 | 21.0k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 21.0k | let count = reader.read_var_u32()?; | 103 | 21.0k | Ok(SectionLimited { | 104 | 21.0k | reader, | 105 | 21.0k | count, | 106 | 21.0k | _marker: marker::PhantomData, | 107 | 21.0k | }) | 108 | 21.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::ImportItemCompact>>::new Line | Count | Source | 101 | 2.46k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 2.46k | let count = reader.read_var_u32()?; | 103 | 2.46k | Ok(SectionLimited { | 104 | 2.46k | reader, | 105 | 2.46k | count, | 106 | 2.46k | _marker: marker::PhantomData, | 107 | 2.46k | }) | 108 | 2.46k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports>>::new Line | Count | Source | 101 | 36.5k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 36.5k | let count = reader.read_var_u32()?; | 103 | 36.5k | Ok(SectionLimited { | 104 | 36.5k | reader, | 105 | 36.5k | count, | 106 | 36.5k | _marker: marker::PhantomData, | 107 | 36.5k | }) | 108 | 36.5k | } |
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 | 10.5k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 10.5k | let count = reader.read_var_u32()?; | 103 | 10.5k | Ok(SectionLimited { | 104 | 10.5k | reader, | 105 | 10.5k | count, | 106 | 10.5k | _marker: marker::PhantomData, | 107 | 10.5k | }) | 108 | 10.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersField>>::new Line | Count | Source | 101 | 7.58k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 7.58k | let count = reader.read_var_u32()?; | 103 | 7.58k | Ok(SectionLimited { | 104 | 7.58k | reader, | 105 | 7.58k | count, | 106 | 7.58k | _marker: marker::PhantomData, | 107 | 7.58k | }) | 108 | 7.58k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue>>::new Line | Count | Source | 101 | 3.79k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 3.79k | let count = reader.read_var_u32()?; | 103 | 3.79k | Ok(SectionLimited { | 104 | 3.79k | reader, | 105 | 3.79k | count, | 106 | 3.79k | _marker: marker::PhantomData, | 107 | 3.79k | }) | 108 | 3.79k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::new Line | Count | Source | 101 | 40.4k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 40.4k | let count = reader.read_var_u32()?; | 103 | 40.4k | Ok(SectionLimited { | 104 | 40.4k | reader, | 105 | 40.4k | count, | 106 | 40.4k | _marker: marker::PhantomData, | 107 | 40.4k | }) | 108 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::new Line | Count | Source | 101 | 190k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 190k | let count = reader.read_var_u32()?; | 103 | 190k | Ok(SectionLimited { | 104 | 190k | reader, | 105 | 190k | count, | 106 | 190k | _marker: marker::PhantomData, | 107 | 190k | }) | 108 | 190k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::new <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::new Line | Count | Source | 101 | 46.3k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 46.3k | let count = reader.read_var_u32()?; | 103 | 46.3k | Ok(SectionLimited { | 104 | 46.3k | reader, | 105 | 46.3k | count, | 106 | 46.3k | _marker: marker::PhantomData, | 107 | 46.3k | }) | 108 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::new Line | Count | Source | 101 | 170k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 170k | let count = reader.read_var_u32()?; | 103 | 170k | Ok(SectionLimited { | 104 | 170k | reader, | 105 | 170k | count, | 106 | 170k | _marker: marker::PhantomData, | 107 | 170k | }) | 108 | 170k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::new Line | Count | Source | 101 | 26.7k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 26.7k | let count = reader.read_var_u32()?; | 103 | 26.7k | Ok(SectionLimited { | 104 | 26.7k | reader, | 105 | 26.7k | count, | 106 | 26.7k | _marker: marker::PhantomData, | 107 | 26.7k | }) | 108 | 26.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::new Line | Count | Source | 101 | 18.3k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 18.3k | let count = reader.read_var_u32()?; | 103 | 18.3k | Ok(SectionLimited { | 104 | 18.3k | reader, | 105 | 18.3k | count, | 106 | 18.3k | _marker: marker::PhantomData, | 107 | 18.3k | }) | 108 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::new Line | Count | Source | 101 | 30.7k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 30.7k | let count = reader.read_var_u32()?; | 103 | 30.7k | Ok(SectionLimited { | 104 | 30.7k | reader, | 105 | 30.7k | count, | 106 | 30.7k | _marker: marker::PhantomData, | 107 | 30.7k | }) | 108 | 30.7k | } |
<wasmparser::readers::SectionLimited<&str>>::new Line | Count | Source | 101 | 3.69k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 3.69k | let count = reader.read_var_u32()?; | 103 | 3.69k | Ok(SectionLimited { | 104 | 3.69k | reader, | 105 | 3.69k | count, | 106 | 3.69k | _marker: marker::PhantomData, | 107 | 3.69k | }) | 108 | 3.69k | } |
<wasmparser::readers::SectionLimited<u32>>::new Line | Count | Source | 101 | 105k | pub fn new(mut reader: BinaryReader<'a>) -> Result<Self> { | 102 | 105k | let count = reader.read_var_u32()?; | 103 | 105k | Ok(SectionLimited { | 104 | 105k | reader, | 105 | 105k | count, | 106 | 105k | _marker: marker::PhantomData, | 107 | 105k | }) | 108 | 105k | } |
|
109 | | |
110 | | /// Returns the count of total items within this section. |
111 | 828k | pub fn count(&self) -> u32 { |
112 | 828k | self.count |
113 | 828k | } 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 | 847 | pub fn count(&self) -> u32 { | 112 | 847 | self.count | 113 | 847 | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::count Line | Count | Source | 111 | 12.3k | pub fn count(&self) -> u32 { | 112 | 12.3k | self.count | 113 | 12.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr>>::count Line | Count | Source | 111 | 33.7k | pub fn count(&self) -> u32 { | 112 | 33.7k | self.count | 113 | 33.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::count Line | Count | Source | 111 | 23.4k | pub fn count(&self) -> u32 { | 112 | 23.4k | self.count | 113 | 23.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::count Line | Count | Source | 111 | 1.75k | pub fn count(&self) -> u32 { | 112 | 1.75k | self.count | 113 | 1.75k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::count Line | Count | Source | 111 | 43.2k | pub fn count(&self) -> u32 { | 112 | 43.2k | self.count | 113 | 43.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::count Line | Count | Source | 111 | 9.70k | pub fn count(&self) -> u32 { | 112 | 9.70k | self.count | 113 | 9.70k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::count Line | Count | Source | 111 | 25.4k | pub fn count(&self) -> u32 { | 112 | 25.4k | self.count | 113 | 25.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::count Line | Count | Source | 111 | 11.7k | pub fn count(&self) -> u32 { | 112 | 11.7k | self.count | 113 | 11.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports>>::count Line | Count | Source | 111 | 26.4k | pub fn count(&self) -> u32 { | 112 | 26.4k | self.count | 113 | 26.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::count Line | Count | Source | 111 | 8.55k | pub fn count(&self) -> u32 { | 112 | 8.55k | self.count | 113 | 8.55k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::count Line | Count | Source | 111 | 40.4k | pub fn count(&self) -> u32 { | 112 | 40.4k | self.count | 113 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::count Line | Count | Source | 111 | 183k | pub fn count(&self) -> u32 { | 112 | 183k | self.count | 113 | 183k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::count <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::count Line | Count | Source | 111 | 46.3k | pub fn count(&self) -> u32 { | 112 | 46.3k | self.count | 113 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::count Line | Count | Source | 111 | 162k | pub fn count(&self) -> u32 { | 112 | 162k | self.count | 113 | 162k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::count Line | Count | Source | 111 | 26.7k | pub fn count(&self) -> u32 { | 112 | 26.7k | self.count | 113 | 26.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::count Line | Count | Source | 111 | 18.3k | pub fn count(&self) -> u32 { | 112 | 18.3k | self.count | 113 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::count Line | Count | Source | 111 | 30.7k | pub fn count(&self) -> u32 { | 112 | 30.7k | self.count | 113 | 30.7k | } |
<wasmparser::readers::SectionLimited<u32>>::count Line | Count | Source | 111 | 122k | pub fn count(&self) -> u32 { | 112 | 122k | self.count | 113 | 122k | } |
|
114 | | |
115 | | /// Returns whether the original byte offset of this section. |
116 | 0 | pub fn original_position(&self) -> u64 { |
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 | 726k | pub fn range(&self) -> Range<u64> { |
123 | 726k | self.reader.range() |
124 | 726k | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHintFunction>>::range <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::range Line | Count | Source | 122 | 3.64k | pub fn range(&self) -> Range<u64> { | 123 | 3.64k | self.reader.range() | 124 | 3.64k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::range Line | Count | Source | 122 | 32.5k | pub fn range(&self) -> Range<u64> { | 123 | 32.5k | self.reader.range() | 124 | 32.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::range Line | Count | Source | 122 | 1.49k | pub fn range(&self) -> Range<u64> { | 123 | 1.49k | self.reader.range() | 124 | 1.49k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::range Line | Count | Source | 122 | 52.4k | pub fn range(&self) -> Range<u64> { | 123 | 52.4k | self.reader.range() | 124 | 52.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::range Line | Count | Source | 122 | 7.59k | pub fn range(&self) -> Range<u64> { | 123 | 7.59k | self.reader.range() | 124 | 7.59k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::range Line | Count | Source | 122 | 34.7k | pub fn range(&self) -> Range<u64> { | 123 | 34.7k | self.reader.range() | 124 | 34.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::range Line | Count | Source | 122 | 10.0k | pub fn range(&self) -> Range<u64> { | 123 | 10.0k | self.reader.range() | 124 | 10.0k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports>>::range Line | Count | Source | 122 | 28.4k | pub fn range(&self) -> Range<u64> { | 123 | 28.4k | self.reader.range() | 124 | 28.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::range Line | Count | Source | 122 | 6.98k | pub fn range(&self) -> Range<u64> { | 123 | 6.98k | self.reader.range() | 124 | 6.98k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::range Line | Count | Source | 122 | 40.4k | pub fn range(&self) -> Range<u64> { | 123 | 40.4k | self.reader.range() | 124 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::range Line | Count | Source | 122 | 183k | pub fn range(&self) -> Range<u64> { | 123 | 183k | self.reader.range() | 124 | 183k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::component::types::CoreType>>::range <wasmparser::readers::SectionLimited<wasmparser::readers::component::aliases::ComponentAlias>>::range Line | Count | Source | 122 | 46.3k | pub fn range(&self) -> Range<u64> { | 123 | 46.3k | self.reader.range() | 124 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::range Line | Count | Source | 122 | 162k | pub fn range(&self) -> Range<u64> { | 123 | 162k | self.reader.range() | 124 | 162k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::range Line | Count | Source | 122 | 26.7k | pub fn range(&self) -> Range<u64> { | 123 | 26.7k | self.reader.range() | 124 | 26.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::range Line | Count | Source | 122 | 18.3k | pub fn range(&self) -> Range<u64> { | 123 | 18.3k | self.reader.range() | 124 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::range Line | Count | Source | 122 | 30.7k | pub fn range(&self) -> Range<u64> { | 123 | 30.7k | self.reader.range() | 124 | 30.7k | } |
<wasmparser::readers::SectionLimited<u32>>::range Line | Count | Source | 122 | 40.0k | pub fn range(&self) -> Range<u64> { | 123 | 40.0k | self.reader.range() | 124 | 40.0k | } |
|
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 | 737k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> |
129 | 737k | where |
130 | 737k | T: FromReader<'a>, |
131 | | { |
132 | 737k | SectionLimitedIntoIterWithOffsets { |
133 | 737k | iter: self.into_iter(), |
134 | 737k | } |
135 | 737k | } Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue>>::into_iter_with_offsets Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHint>>::into_iter_with_offsets Unexecuted instantiation: <wasmparser::readers::SectionLimited<wasmparser::readers::core::branch_hinting::BranchHintFunction>>::into_iter_with_offsets <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data>>::into_iter_with_offsets Line | Count | Source | 128 | 4.57k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 4.57k | where | 130 | 4.57k | T: FromReader<'a>, | 131 | | { | 132 | 4.57k | SectionLimitedIntoIterWithOffsets { | 133 | 4.57k | iter: self.into_iter(), | 134 | 4.57k | } | 135 | 4.57k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::MemoryType>>::into_iter_with_offsets Line | Count | Source | 128 | 22.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 22.3k | where | 130 | 22.3k | T: FromReader<'a>, | 131 | | { | 132 | 22.3k | SectionLimitedIntoIterWithOffsets { | 133 | 22.3k | iter: self.into_iter(), | 134 | 22.3k | } | 135 | 22.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType>>::into_iter_with_offsets Line | Count | Source | 128 | 1.58k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 1.58k | where | 130 | 1.58k | T: FromReader<'a>, | 131 | | { | 132 | 1.58k | SectionLimitedIntoIterWithOffsets { | 133 | 1.58k | iter: self.into_iter(), | 134 | 1.58k | } | 135 | 1.58k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup>>::into_iter_with_offsets Line | Count | Source | 128 | 45.5k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 45.5k | where | 130 | 45.5k | T: FromReader<'a>, | 131 | | { | 132 | 45.5k | SectionLimitedIntoIterWithOffsets { | 133 | 45.5k | iter: self.into_iter(), | 134 | 45.5k | } | 135 | 45.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table>>::into_iter_with_offsets Line | Count | Source | 128 | 8.66k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 8.66k | where | 130 | 8.66k | T: FromReader<'a>, | 131 | | { | 132 | 8.66k | SectionLimitedIntoIterWithOffsets { | 133 | 8.66k | iter: self.into_iter(), | 134 | 8.66k | } | 135 | 8.66k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export>>::into_iter_with_offsets Line | Count | Source | 128 | 24.5k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 24.5k | where | 130 | 24.5k | T: FromReader<'a>, | 131 | | { | 132 | 24.5k | SectionLimitedIntoIterWithOffsets { | 133 | 24.5k | iter: self.into_iter(), | 134 | 24.5k | } | 135 | 24.5k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global>>::into_iter_with_offsets Line | Count | Source | 128 | 11.6k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 11.6k | where | 130 | 11.6k | T: FromReader<'a>, | 131 | | { | 132 | 11.6k | SectionLimitedIntoIterWithOffsets { | 133 | 11.6k | iter: self.into_iter(), | 134 | 11.6k | } | 135 | 11.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::ImportItemCompact>>::into_iter_with_offsets Line | Count | Source | 128 | 2.35k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 2.35k | where | 130 | 2.35k | T: FromReader<'a>, | 131 | | { | 132 | 2.35k | SectionLimitedIntoIterWithOffsets { | 133 | 2.35k | iter: self.into_iter(), | 134 | 2.35k | } | 135 | 2.35k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports>>::into_iter_with_offsets Line | Count | Source | 128 | 26.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 26.3k | where | 130 | 26.3k | T: FromReader<'a>, | 131 | | { | 132 | 26.3k | SectionLimitedIntoIterWithOffsets { | 133 | 26.3k | iter: self.into_iter(), | 134 | 26.3k | } | 135 | 26.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element>>::into_iter_with_offsets Line | Count | Source | 128 | 7.96k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 7.96k | where | 130 | 7.96k | T: FromReader<'a>, | 131 | | { | 132 | 7.96k | SectionLimitedIntoIterWithOffsets { | 133 | 7.96k | iter: self.into_iter(), | 134 | 7.96k | } | 135 | 7.96k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction>>::into_iter_with_offsets Line | Count | Source | 128 | 40.4k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 40.4k | where | 130 | 40.4k | T: FromReader<'a>, | 131 | | { | 132 | 40.4k | SectionLimitedIntoIterWithOffsets { | 133 | 40.4k | iter: self.into_iter(), | 134 | 40.4k | } | 135 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType>>::into_iter_with_offsets Line | Count | Source | 128 | 183k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 183k | where | 130 | 183k | T: FromReader<'a>, | 131 | | { | 132 | 183k | SectionLimitedIntoIterWithOffsets { | 133 | 183k | iter: self.into_iter(), | 134 | 183k | } | 135 | 183k | } |
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 | 46.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 46.3k | where | 130 | 46.3k | T: FromReader<'a>, | 131 | | { | 132 | 46.3k | SectionLimitedIntoIterWithOffsets { | 133 | 46.3k | iter: self.into_iter(), | 134 | 46.3k | } | 135 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport>>::into_iter_with_offsets Line | Count | Source | 128 | 162k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 162k | where | 130 | 162k | T: FromReader<'a>, | 131 | | { | 132 | 162k | SectionLimitedIntoIterWithOffsets { | 133 | 162k | iter: self.into_iter(), | 134 | 162k | } | 135 | 162k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport>>::into_iter_with_offsets Line | Count | Source | 128 | 26.7k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 26.7k | where | 130 | 26.7k | T: FromReader<'a>, | 131 | | { | 132 | 26.7k | SectionLimitedIntoIterWithOffsets { | 133 | 26.7k | iter: self.into_iter(), | 134 | 26.7k | } | 135 | 26.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance>>::into_iter_with_offsets Line | Count | Source | 128 | 18.3k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 18.3k | where | 130 | 18.3k | T: FromReader<'a>, | 131 | | { | 132 | 18.3k | SectionLimitedIntoIterWithOffsets { | 133 | 18.3k | iter: self.into_iter(), | 134 | 18.3k | } | 135 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance>>::into_iter_with_offsets Line | Count | Source | 128 | 30.7k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 30.7k | where | 130 | 30.7k | T: FromReader<'a>, | 131 | | { | 132 | 30.7k | SectionLimitedIntoIterWithOffsets { | 133 | 30.7k | iter: self.into_iter(), | 134 | 30.7k | } | 135 | 30.7k | } |
<wasmparser::readers::SectionLimited<&str>>::into_iter_with_offsets Line | Count | Source | 128 | 3.53k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 3.53k | where | 130 | 3.53k | T: FromReader<'a>, | 131 | | { | 132 | 3.53k | SectionLimitedIntoIterWithOffsets { | 133 | 3.53k | iter: self.into_iter(), | 134 | 3.53k | } | 135 | 3.53k | } |
<wasmparser::readers::SectionLimited<u32>>::into_iter_with_offsets Line | Count | Source | 128 | 69.4k | pub fn into_iter_with_offsets(self) -> SectionLimitedIntoIterWithOffsets<'a, T> | 129 | 69.4k | where | 130 | 69.4k | T: FromReader<'a>, | 131 | | { | 132 | 69.4k | SectionLimitedIntoIterWithOffsets { | 133 | 69.4k | iter: self.into_iter(), | 134 | 69.4k | } | 135 | 69.4k | } |
|
136 | | } |
137 | | |
138 | | impl<T> Clone for SectionLimited<'_, T> { |
139 | 667k | fn clone(&self) -> Self { |
140 | 667k | SectionLimited { |
141 | 667k | reader: self.reader.clone(), |
142 | 667k | count: self.count, |
143 | 667k | _marker: self._marker, |
144 | 667k | } |
145 | 667k | } 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 | 3.03k | fn clone(&self) -> Self { | 140 | 3.03k | SectionLimited { | 141 | 3.03k | reader: self.reader.clone(), | 142 | 3.03k | count: self.count, | 143 | 3.03k | _marker: self._marker, | 144 | 3.03k | } | 145 | 3.03k | } |
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 | 19.9k | fn clone(&self) -> Self { | 140 | 19.9k | SectionLimited { | 141 | 19.9k | reader: self.reader.clone(), | 142 | 19.9k | count: self.count, | 143 | 19.9k | _marker: self._marker, | 144 | 19.9k | } | 145 | 19.9k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::TagType> as core::clone::Clone>::clone Line | Count | Source | 139 | 653 | fn clone(&self) -> Self { | 140 | 653 | SectionLimited { | 141 | 653 | reader: self.reader.clone(), | 142 | 653 | count: self.count, | 143 | 653 | _marker: self._marker, | 144 | 653 | } | 145 | 653 | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::types::RecGroup> as core::clone::Clone>::clone Line | Count | Source | 139 | 38.6k | fn clone(&self) -> Self { | 140 | 38.6k | SectionLimited { | 141 | 38.6k | reader: self.reader.clone(), | 142 | 38.6k | count: self.count, | 143 | 38.6k | _marker: self._marker, | 144 | 38.6k | } | 145 | 38.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table> as core::clone::Clone>::clone Line | Count | Source | 139 | 6.43k | fn clone(&self) -> Self { | 140 | 6.43k | SectionLimited { | 141 | 6.43k | reader: self.reader.clone(), | 142 | 6.43k | count: self.count, | 143 | 6.43k | _marker: self._marker, | 144 | 6.43k | } | 145 | 6.43k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export> as core::clone::Clone>::clone Line | Count | Source | 139 | 23.3k | fn clone(&self) -> Self { | 140 | 23.3k | SectionLimited { | 141 | 23.3k | reader: self.reader.clone(), | 142 | 23.3k | count: self.count, | 143 | 23.3k | _marker: self._marker, | 144 | 23.3k | } | 145 | 23.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global> as core::clone::Clone>::clone Line | Count | Source | 139 | 8.32k | fn clone(&self) -> Self { | 140 | 8.32k | SectionLimited { | 141 | 8.32k | reader: self.reader.clone(), | 142 | 8.32k | count: self.count, | 143 | 8.32k | _marker: self._marker, | 144 | 8.32k | } | 145 | 8.32k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports> as core::clone::Clone>::clone Line | Count | Source | 139 | 25.2k | fn clone(&self) -> Self { | 140 | 25.2k | SectionLimited { | 141 | 25.2k | reader: self.reader.clone(), | 142 | 25.2k | count: self.count, | 143 | 25.2k | _marker: self._marker, | 144 | 25.2k | } | 145 | 25.2k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element> as core::clone::Clone>::clone Line | Count | Source | 139 | 6.34k | fn clone(&self) -> Self { | 140 | 6.34k | SectionLimited { | 141 | 6.34k | reader: self.reader.clone(), | 142 | 6.34k | count: self.count, | 143 | 6.34k | _marker: self._marker, | 144 | 6.34k | } | 145 | 6.34k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction> as core::clone::Clone>::clone Line | Count | Source | 139 | 40.4k | fn clone(&self) -> Self { | 140 | 40.4k | SectionLimited { | 141 | 40.4k | reader: self.reader.clone(), | 142 | 40.4k | count: self.count, | 143 | 40.4k | _marker: self._marker, | 144 | 40.4k | } | 145 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType> as core::clone::Clone>::clone Line | Count | Source | 139 | 183k | fn clone(&self) -> Self { | 140 | 183k | SectionLimited { | 141 | 183k | reader: self.reader.clone(), | 142 | 183k | count: self.count, | 143 | 183k | _marker: self._marker, | 144 | 183k | } | 145 | 183k | } |
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 | 46.3k | fn clone(&self) -> Self { | 140 | 46.3k | SectionLimited { | 141 | 46.3k | reader: self.reader.clone(), | 142 | 46.3k | count: self.count, | 143 | 46.3k | _marker: self._marker, | 144 | 46.3k | } | 145 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport> as core::clone::Clone>::clone Line | Count | Source | 139 | 162k | fn clone(&self) -> Self { | 140 | 162k | SectionLimited { | 141 | 162k | reader: self.reader.clone(), | 142 | 162k | count: self.count, | 143 | 162k | _marker: self._marker, | 144 | 162k | } | 145 | 162k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport> as core::clone::Clone>::clone Line | Count | Source | 139 | 26.7k | fn clone(&self) -> Self { | 140 | 26.7k | SectionLimited { | 141 | 26.7k | reader: self.reader.clone(), | 142 | 26.7k | count: self.count, | 143 | 26.7k | _marker: self._marker, | 144 | 26.7k | } | 145 | 26.7k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance> as core::clone::Clone>::clone Line | Count | Source | 139 | 18.3k | fn clone(&self) -> Self { | 140 | 18.3k | SectionLimited { | 141 | 18.3k | reader: self.reader.clone(), | 142 | 18.3k | count: self.count, | 143 | 18.3k | _marker: self._marker, | 144 | 18.3k | } | 145 | 18.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::Instance> as core::clone::Clone>::clone Line | Count | Source | 139 | 30.7k | fn clone(&self) -> Self { | 140 | 30.7k | SectionLimited { | 141 | 30.7k | reader: self.reader.clone(), | 142 | 30.7k | count: self.count, | 143 | 30.7k | _marker: self._marker, | 144 | 30.7k | } | 145 | 30.7k | } |
<wasmparser::readers::SectionLimited<u32> as core::clone::Clone>::clone Line | Count | Source | 139 | 26.9k | fn clone(&self) -> Self { | 140 | 26.9k | SectionLimited { | 141 | 26.9k | reader: self.reader.clone(), | 142 | 26.9k | count: self.count, | 143 | 26.9k | _marker: self._marker, | 144 | 26.9k | } | 145 | 26.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 | 931k | fn into_iter(self) -> Self::IntoIter { |
165 | 931k | SectionLimitedIntoIter { |
166 | 931k | remaining: self.count, |
167 | 931k | section: self, |
168 | 931k | end: false, |
169 | 931k | } |
170 | 931k | } 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 | 6.64k | fn into_iter(self) -> Self::IntoIter { | 165 | 6.64k | SectionLimitedIntoIter { | 166 | 6.64k | remaining: self.count, | 167 | 6.64k | section: self, | 168 | 6.64k | end: false, | 169 | 6.64k | } | 170 | 6.64k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 3.79k | fn into_iter(self) -> Self::IntoIter { | 165 | 3.79k | SectionLimitedIntoIter { | 166 | 3.79k | remaining: self.count, | 167 | 3.79k | section: self, | 168 | 3.79k | end: false, | 169 | 3.79k | } | 170 | 3.79k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 3.79k | fn into_iter(self) -> Self::IntoIter { | 165 | 3.79k | SectionLimitedIntoIter { | 166 | 3.79k | remaining: self.count, | 167 | 3.79k | section: self, | 168 | 3.79k | end: false, | 169 | 3.79k | } | 170 | 3.79k | } |
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 <wasmparser::readers::SectionLimited<wasmparser::readers::core::data::Data> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 5.01k | fn into_iter(self) -> Self::IntoIter { | 165 | 5.01k | SectionLimitedIntoIter { | 166 | 5.01k | remaining: self.count, | 167 | 5.01k | section: self, | 168 | 5.01k | end: false, | 169 | 5.01k | } | 170 | 5.01k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::init::ConstExpr> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 80.1k | fn into_iter(self) -> Self::IntoIter { | 165 | 80.1k | SectionLimitedIntoIter { | 166 | 80.1k | remaining: self.count, | 167 | 80.1k | section: self, | 168 | 80.1k | end: false, | 169 | 80.1k | } | 170 | 80.1k | } |
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::types::MemoryType> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 24.7k | fn into_iter(self) -> Self::IntoIter { | 165 | 24.7k | SectionLimitedIntoIter { | 166 | 24.7k | remaining: self.count, | 167 | 24.7k | section: self, | 168 | 24.7k | end: false, | 169 | 24.7k | } | 170 | 24.7k | } |
<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 | 47.6k | fn into_iter(self) -> Self::IntoIter { | 165 | 47.6k | SectionLimitedIntoIter { | 166 | 47.6k | remaining: self.count, | 167 | 47.6k | section: self, | 168 | 47.6k | end: false, | 169 | 47.6k | } | 170 | 47.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::tables::Table> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 10.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 10.3k | SectionLimitedIntoIter { | 166 | 10.3k | remaining: self.count, | 167 | 10.3k | section: self, | 168 | 10.3k | end: false, | 169 | 10.3k | } | 170 | 10.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::exports::Export> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 30.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 30.4k | SectionLimitedIntoIter { | 166 | 30.4k | remaining: self.count, | 167 | 30.4k | section: self, | 168 | 30.4k | end: false, | 169 | 30.4k | } | 170 | 30.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::globals::Global> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 17.6k | fn into_iter(self) -> Self::IntoIter { | 165 | 17.6k | SectionLimitedIntoIter { | 166 | 17.6k | remaining: self.count, | 167 | 17.6k | section: self, | 168 | 17.6k | end: false, | 169 | 17.6k | } | 170 | 17.6k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::ImportItemCompact> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 2.46k | fn into_iter(self) -> Self::IntoIter { | 165 | 2.46k | SectionLimitedIntoIter { | 166 | 2.46k | remaining: self.count, | 167 | 2.46k | section: self, | 168 | 2.46k | end: false, | 169 | 2.46k | } | 170 | 2.46k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::imports::Imports> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 32.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 32.3k | SectionLimitedIntoIter { | 166 | 32.3k | remaining: self.count, | 167 | 32.3k | section: self, | 168 | 32.3k | end: false, | 169 | 32.3k | } | 170 | 32.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::core::elements::Element> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 8.36k | fn into_iter(self) -> Self::IntoIter { | 165 | 8.36k | SectionLimitedIntoIter { | 166 | 8.36k | remaining: self.count, | 167 | 8.36k | section: self, | 168 | 8.36k | end: false, | 169 | 8.36k | } | 170 | 8.36k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 40.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 40.4k | SectionLimitedIntoIter { | 166 | 40.4k | remaining: self.count, | 167 | 40.4k | section: self, | 168 | 40.4k | end: false, | 169 | 40.4k | } | 170 | 40.4k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::types::ComponentType> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 183k | fn into_iter(self) -> Self::IntoIter { | 165 | 183k | SectionLimitedIntoIter { | 166 | 183k | remaining: self.count, | 167 | 183k | section: self, | 168 | 183k | end: false, | 169 | 183k | } | 170 | 183k | } |
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 | 46.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 46.3k | SectionLimitedIntoIter { | 166 | 46.3k | remaining: self.count, | 167 | 46.3k | section: self, | 168 | 46.3k | end: false, | 169 | 46.3k | } | 170 | 46.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 209k | fn into_iter(self) -> Self::IntoIter { | 165 | 209k | SectionLimitedIntoIter { | 166 | 209k | remaining: self.count, | 167 | 209k | section: self, | 168 | 209k | end: false, | 169 | 209k | } | 170 | 209k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 32.3k | fn into_iter(self) -> Self::IntoIter { | 165 | 32.3k | SectionLimitedIntoIter { | 166 | 32.3k | remaining: self.count, | 167 | 32.3k | section: self, | 168 | 32.3k | end: false, | 169 | 32.3k | } | 170 | 32.3k | } |
<wasmparser::readers::SectionLimited<wasmparser::readers::component::instances::ComponentInstance> 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::component::instances::Instance> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 30.7k | fn into_iter(self) -> Self::IntoIter { | 165 | 30.7k | SectionLimitedIntoIter { | 166 | 30.7k | remaining: self.count, | 167 | 30.7k | section: self, | 168 | 30.7k | end: false, | 169 | 30.7k | } | 170 | 30.7k | } |
<wasmparser::readers::SectionLimited<&str> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 3.69k | fn into_iter(self) -> Self::IntoIter { | 165 | 3.69k | SectionLimitedIntoIter { | 166 | 3.69k | remaining: self.count, | 167 | 3.69k | section: self, | 168 | 3.69k | end: false, | 169 | 3.69k | } | 170 | 3.69k | } |
<wasmparser::readers::SectionLimited<u32> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 164 | 91.4k | fn into_iter(self) -> Self::IntoIter { | 165 | 91.4k | SectionLimitedIntoIter { | 166 | 91.4k | remaining: self.count, | 167 | 91.4k | section: self, | 168 | 91.4k | end: false, | 169 | 91.4k | } | 170 | 91.4k | } |
|
171 | | } |
172 | | |
173 | | /// A consuming iterator of a [`SectionLimited`]. |
174 | | /// |
175 | | /// This is created via the [`IntoIterator`] `impl` for the [`SectionLimited`] |
176 | | /// type. |
177 | | #[derive(Debug, Clone)] |
178 | | pub struct SectionLimitedIntoIter<'a, T> { |
179 | | section: SectionLimited<'a, T>, |
180 | | remaining: u32, |
181 | | end: bool, |
182 | | } |
183 | | |
184 | | impl<T> SectionLimitedIntoIter<'_, T> { |
185 | | /// Returns the current byte offset of the section within this iterator. |
186 | 0 | pub fn original_position(&self) -> u64 { |
187 | 0 | self.section.reader.original_position() |
188 | 0 | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::IndirectNaming>>::original_position Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::names::Naming>>::original_position |
189 | | } |
190 | | |
191 | | impl<'a, T> Iterator for SectionLimitedIntoIter<'a, T> |
192 | | where |
193 | | T: FromReader<'a>, |
194 | | { |
195 | | type Item = Result<T>; |
196 | | |
197 | 4.64M | fn next(&mut self) -> Option<Result<T>> { |
198 | 4.64M | if self.end { |
199 | 0 | return None; |
200 | 4.64M | } |
201 | 4.64M | if self.remaining == 0 { |
202 | 931k | self.end = true; |
203 | 931k | if self.section.reader.eof() { |
204 | 931k | return None; |
205 | 0 | } |
206 | 0 | return Some(Err(Error::new( |
207 | 0 | "section size mismatch: unexpected data at the end of the section", |
208 | 0 | self.section.reader.original_position(), |
209 | 0 | ))); |
210 | 3.71M | } |
211 | 3.71M | let result = self.section.reader.read(); |
212 | 3.71M | self.end = result.is_err(); |
213 | 3.71M | self.remaining -= 1; |
214 | 3.71M | Some(result) |
215 | 4.64M | } 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 | 197 | 246k | fn next(&mut self) -> Option<Result<T>> { | 198 | 246k | if self.end { | 199 | 0 | return None; | 200 | 246k | } | 201 | 246k | if self.remaining == 0 { | 202 | 6.64k | self.end = true; | 203 | 6.64k | if self.section.reader.eof() { | 204 | 6.64k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 240k | } | 211 | 240k | let result = self.section.reader.read(); | 212 | 240k | self.end = result.is_err(); | 213 | 240k | self.remaining -= 1; | 214 | 240k | Some(result) | 215 | 246k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersField> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 7.58k | fn next(&mut self) -> Option<Result<T>> { | 198 | 7.58k | if self.end { | 199 | 0 | return None; | 200 | 7.58k | } | 201 | 7.58k | if self.remaining == 0 { | 202 | 3.79k | self.end = true; | 203 | 3.79k | if self.section.reader.eof() { | 204 | 3.79k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 3.79k | } | 211 | 3.79k | let result = self.section.reader.read(); | 212 | 3.79k | self.end = result.is_err(); | 213 | 3.79k | self.remaining -= 1; | 214 | 3.79k | Some(result) | 215 | 7.58k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 7.58k | fn next(&mut self) -> Option<Result<T>> { | 198 | 7.58k | if self.end { | 199 | 0 | return None; | 200 | 7.58k | } | 201 | 7.58k | if self.remaining == 0 { | 202 | 3.79k | self.end = true; | 203 | 3.79k | if self.section.reader.eof() { | 204 | 3.79k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 3.79k | } | 211 | 3.79k | let result = self.section.reader.read(); | 212 | 3.79k | self.end = result.is_err(); | 213 | 3.79k | self.remaining -= 1; | 214 | 3.79k | Some(result) | 215 | 7.58k | } |
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 <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::data::Data> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 72.2k | fn next(&mut self) -> Option<Result<T>> { | 198 | 72.2k | if self.end { | 199 | 0 | return None; | 200 | 72.2k | } | 201 | 72.2k | if self.remaining == 0 { | 202 | 5.01k | self.end = true; | 203 | 5.01k | if self.section.reader.eof() { | 204 | 5.01k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 67.2k | } | 211 | 67.2k | let result = self.section.reader.read(); | 212 | 67.2k | self.end = result.is_err(); | 213 | 67.2k | self.remaining -= 1; | 214 | 67.2k | Some(result) | 215 | 72.2k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::init::ConstExpr> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 80.1k | fn next(&mut self) -> Option<Result<T>> { | 198 | 80.1k | if self.end { | 199 | 0 | return None; | 200 | 80.1k | } | 201 | 80.1k | if self.remaining == 0 { | 202 | 80.1k | self.end = true; | 203 | 80.1k | if self.section.reader.eof() { | 204 | 80.1k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 0 | } | 211 | 0 | let result = self.section.reader.read(); | 212 | 0 | self.end = result.is_err(); | 213 | 0 | self.remaining -= 1; | 214 | 0 | Some(result) | 215 | 80.1k | } |
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::types::MemoryType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 131k | fn next(&mut self) -> Option<Result<T>> { | 198 | 131k | if self.end { | 199 | 0 | return None; | 200 | 131k | } | 201 | 131k | if self.remaining == 0 { | 202 | 24.7k | self.end = true; | 203 | 24.7k | if self.section.reader.eof() { | 204 | 24.7k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 106k | } | 211 | 106k | let result = self.section.reader.read(); | 212 | 106k | self.end = result.is_err(); | 213 | 106k | self.remaining -= 1; | 214 | 106k | Some(result) | 215 | 131k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::TagType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 61.5k | fn next(&mut self) -> Option<Result<T>> { | 198 | 61.5k | if self.end { | 199 | 0 | return None; | 200 | 61.5k | } | 201 | 61.5k | if self.remaining == 0 { | 202 | 1.85k | self.end = true; | 203 | 1.85k | if self.section.reader.eof() { | 204 | 1.85k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 59.7k | } | 211 | 59.7k | let result = self.section.reader.read(); | 212 | 59.7k | self.end = result.is_err(); | 213 | 59.7k | self.remaining -= 1; | 214 | 59.7k | Some(result) | 215 | 61.5k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 438k | fn next(&mut self) -> Option<Result<T>> { | 198 | 438k | if self.end { | 199 | 0 | return None; | 200 | 438k | } | 201 | 438k | if self.remaining == 0 { | 202 | 47.3k | self.end = true; | 203 | 47.3k | if self.section.reader.eof() { | 204 | 47.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 391k | } | 211 | 391k | let result = self.section.reader.read(); | 212 | 391k | self.end = result.is_err(); | 213 | 391k | self.remaining -= 1; | 214 | 391k | Some(result) | 215 | 438k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::tables::Table> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 63.0k | fn next(&mut self) -> Option<Result<T>> { | 198 | 63.0k | if self.end { | 199 | 0 | return None; | 200 | 63.0k | } | 201 | 63.0k | if self.remaining == 0 { | 202 | 10.3k | self.end = true; | 203 | 10.3k | if self.section.reader.eof() { | 204 | 10.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 52.6k | } | 211 | 52.6k | let result = self.section.reader.read(); | 212 | 52.6k | self.end = result.is_err(); | 213 | 52.6k | self.remaining -= 1; | 214 | 52.6k | Some(result) | 215 | 63.0k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 305k | fn next(&mut self) -> Option<Result<T>> { | 198 | 305k | if self.end { | 199 | 0 | return None; | 200 | 305k | } | 201 | 305k | if self.remaining == 0 { | 202 | 30.4k | self.end = true; | 203 | 30.4k | if self.section.reader.eof() { | 204 | 30.4k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 274k | } | 211 | 274k | let result = self.section.reader.read(); | 212 | 274k | self.end = result.is_err(); | 213 | 274k | self.remaining -= 1; | 214 | 274k | Some(result) | 215 | 305k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::globals::Global> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 442k | fn next(&mut self) -> Option<Result<T>> { | 198 | 442k | if self.end { | 199 | 0 | return None; | 200 | 442k | } | 201 | 442k | if self.remaining == 0 { | 202 | 17.6k | self.end = true; | 203 | 17.6k | if self.section.reader.eof() { | 204 | 17.6k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 425k | } | 211 | 425k | let result = self.section.reader.read(); | 212 | 425k | self.end = result.is_err(); | 213 | 425k | self.remaining -= 1; | 214 | 425k | Some(result) | 215 | 442k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::imports::ImportItemCompact> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 79.6k | fn next(&mut self) -> Option<Result<T>> { | 198 | 79.6k | if self.end { | 199 | 0 | return None; | 200 | 79.6k | } | 201 | 79.6k | if self.remaining == 0 { | 202 | 2.46k | self.end = true; | 203 | 2.46k | if self.section.reader.eof() { | 204 | 2.46k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 77.1k | } | 211 | 77.1k | let result = self.section.reader.read(); | 212 | 77.1k | self.end = result.is_err(); | 213 | 77.1k | self.remaining -= 1; | 214 | 77.1k | Some(result) | 215 | 79.6k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::imports::Imports> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 268k | fn next(&mut self) -> Option<Result<T>> { | 198 | 268k | if self.end { | 199 | 0 | return None; | 200 | 268k | } | 201 | 268k | if self.remaining == 0 { | 202 | 32.3k | self.end = true; | 203 | 32.3k | if self.section.reader.eof() { | 204 | 32.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 236k | } | 211 | 236k | let result = self.section.reader.read(); | 212 | 236k | self.end = result.is_err(); | 213 | 236k | self.remaining -= 1; | 214 | 236k | Some(result) | 215 | 268k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::elements::Element> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 146k | fn next(&mut self) -> Option<Result<T>> { | 198 | 146k | if self.end { | 199 | 0 | return None; | 200 | 146k | } | 201 | 146k | if self.remaining == 0 { | 202 | 8.36k | self.end = true; | 203 | 8.36k | if self.section.reader.eof() { | 204 | 8.36k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 138k | } | 211 | 138k | let result = self.section.reader.read(); | 212 | 138k | self.end = result.is_err(); | 213 | 138k | self.remaining -= 1; | 214 | 138k | Some(result) | 215 | 146k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 127k | fn next(&mut self) -> Option<Result<T>> { | 198 | 127k | if self.end { | 199 | 0 | return None; | 200 | 127k | } | 201 | 127k | if self.remaining == 0 { | 202 | 40.4k | self.end = true; | 203 | 40.4k | if self.section.reader.eof() { | 204 | 40.4k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 86.6k | } | 211 | 86.6k | let result = self.section.reader.read(); | 212 | 86.6k | self.end = result.is_err(); | 213 | 86.6k | self.remaining -= 1; | 214 | 86.6k | Some(result) | 215 | 127k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::types::ComponentType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 579k | fn next(&mut self) -> Option<Result<T>> { | 198 | 579k | if self.end { | 199 | 0 | return None; | 200 | 579k | } | 201 | 579k | if self.remaining == 0 { | 202 | 183k | self.end = true; | 203 | 183k | if self.section.reader.eof() { | 204 | 183k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 396k | } | 211 | 396k | let result = self.section.reader.read(); | 212 | 396k | self.end = result.is_err(); | 213 | 396k | self.remaining -= 1; | 214 | 396k | Some(result) | 215 | 579k | } |
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 | 197 | 120k | fn next(&mut self) -> Option<Result<T>> { | 198 | 120k | if self.end { | 199 | 0 | return None; | 200 | 120k | } | 201 | 120k | if self.remaining == 0 { | 202 | 46.3k | self.end = true; | 203 | 46.3k | if self.section.reader.eof() { | 204 | 46.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 74.0k | } | 211 | 74.0k | let result = self.section.reader.read(); | 212 | 74.0k | self.end = result.is_err(); | 213 | 74.0k | self.remaining -= 1; | 214 | 74.0k | Some(result) | 215 | 120k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 426k | fn next(&mut self) -> Option<Result<T>> { | 198 | 426k | if self.end { | 199 | 0 | return None; | 200 | 426k | } | 201 | 426k | if self.remaining == 0 { | 202 | 209k | self.end = true; | 203 | 209k | if self.section.reader.eof() { | 204 | 209k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 216k | } | 211 | 216k | let result = self.section.reader.read(); | 212 | 216k | self.end = result.is_err(); | 213 | 216k | self.remaining -= 1; | 214 | 216k | Some(result) | 215 | 426k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 71.6k | fn next(&mut self) -> Option<Result<T>> { | 198 | 71.6k | if self.end { | 199 | 0 | return None; | 200 | 71.6k | } | 201 | 71.6k | if self.remaining == 0 { | 202 | 32.3k | self.end = true; | 203 | 32.3k | if self.section.reader.eof() { | 204 | 32.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 39.2k | } | 211 | 39.2k | let result = self.section.reader.read(); | 212 | 39.2k | self.end = result.is_err(); | 213 | 39.2k | self.remaining -= 1; | 214 | 39.2k | Some(result) | 215 | 71.6k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 36.7k | fn next(&mut self) -> Option<Result<T>> { | 198 | 36.7k | if self.end { | 199 | 0 | return None; | 200 | 36.7k | } | 201 | 36.7k | if self.remaining == 0 { | 202 | 18.3k | self.end = true; | 203 | 18.3k | if self.section.reader.eof() { | 204 | 18.3k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 18.3k | } | 211 | 18.3k | let result = self.section.reader.read(); | 212 | 18.3k | self.end = result.is_err(); | 213 | 18.3k | self.remaining -= 1; | 214 | 18.3k | Some(result) | 215 | 36.7k | } |
<wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::component::instances::Instance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 69.2k | fn next(&mut self) -> Option<Result<T>> { | 198 | 69.2k | if self.end { | 199 | 0 | return None; | 200 | 69.2k | } | 201 | 69.2k | if self.remaining == 0 { | 202 | 30.7k | self.end = true; | 203 | 30.7k | if self.section.reader.eof() { | 204 | 30.7k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 38.5k | } | 211 | 38.5k | let result = self.section.reader.read(); | 212 | 38.5k | self.end = result.is_err(); | 213 | 38.5k | self.remaining -= 1; | 214 | 38.5k | Some(result) | 215 | 69.2k | } |
<wasmparser::readers::SectionLimitedIntoIter<&str> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 92.4k | fn next(&mut self) -> Option<Result<T>> { | 198 | 92.4k | if self.end { | 199 | 0 | return None; | 200 | 92.4k | } | 201 | 92.4k | if self.remaining == 0 { | 202 | 3.69k | self.end = true; | 203 | 3.69k | if self.section.reader.eof() { | 204 | 3.69k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 88.7k | } | 211 | 88.7k | let result = self.section.reader.read(); | 212 | 88.7k | self.end = result.is_err(); | 213 | 88.7k | self.remaining -= 1; | 214 | 88.7k | Some(result) | 215 | 92.4k | } |
<wasmparser::readers::SectionLimitedIntoIter<u32> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 197 | 766k | fn next(&mut self) -> Option<Result<T>> { | 198 | 766k | if self.end { | 199 | 0 | return None; | 200 | 766k | } | 201 | 766k | if self.remaining == 0 { | 202 | 91.4k | self.end = true; | 203 | 91.4k | if self.section.reader.eof() { | 204 | 91.4k | return None; | 205 | 0 | } | 206 | 0 | return Some(Err(Error::new( | 207 | 0 | "section size mismatch: unexpected data at the end of the section", | 208 | 0 | self.section.reader.original_position(), | 209 | 0 | ))); | 210 | 675k | } | 211 | 675k | let result = self.section.reader.read(); | 212 | 675k | self.end = result.is_err(); | 213 | 675k | self.remaining -= 1; | 214 | 675k | Some(result) | 215 | 766k | } |
|
216 | | |
217 | 2.42k | fn size_hint(&self) -> (usize, Option<usize>) { |
218 | 2.42k | let remaining = self.remaining as usize; |
219 | 2.42k | (remaining, Some(remaining)) |
220 | 2.42k | } 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 | 217 | 1.89k | fn size_hint(&self) -> (usize, Option<usize>) { | 218 | 1.89k | let remaining = self.remaining as usize; | 219 | 1.89k | (remaining, Some(remaining)) | 220 | 1.89k | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<&str> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::size_hint <wasmparser::readers::SectionLimitedIntoIter<&str> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 217 | 524 | fn size_hint(&self) -> (usize, Option<usize>) { | 218 | 524 | let remaining = self.remaining as usize; | 219 | 524 | (remaining, Some(remaining)) | 220 | 524 | } |
Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<wasmparser::readers::core::imports::ImportItemCompact> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<&str> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIter<_> as core::iter::traits::iterator::Iterator>::size_hint |
221 | | } |
222 | | |
223 | | impl<'a, T> ExactSizeIterator for SectionLimitedIntoIter<'a, T> where T: FromReader<'a> {} |
224 | | |
225 | | impl<'a, T> From<SectionLimitedIntoIter<'a, T>> for SectionLimited<'a, T> { |
226 | 0 | fn from(iter: SectionLimitedIntoIter<'a, T>) -> Self { |
227 | 0 | iter.section |
228 | 0 | } |
229 | | } |
230 | | |
231 | | /// An iterator over a limited section iterator. |
232 | | pub struct SectionLimitedIntoIterWithOffsets<'a, T> { |
233 | | iter: SectionLimitedIntoIter<'a, T>, |
234 | | } |
235 | | |
236 | | impl<'a, T> Iterator for SectionLimitedIntoIterWithOffsets<'a, T> |
237 | | where |
238 | | T: FromReader<'a>, |
239 | | { |
240 | | type Item = Result<(u64, T)>; |
241 | | |
242 | 3.40M | fn next(&mut self) -> Option<Self::Item> { |
243 | 3.40M | let pos = self.iter.section.reader.original_position(); |
244 | 3.40M | Some(self.iter.next()?.map(|item| (pos, item))) Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next::{closure#0}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::branch_hinting::BranchHintFunction> 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 | 244 | 63.5k | 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 | 244 | 91.3k | 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 | 244 | 49.1k | 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 | 244 | 276k | 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 | 244 | 43.5k | 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 | 244 | 219k | 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 | 244 | 253k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::ImportItemCompact> as core::iter::traits::iterator::Iterator>::next::{closure#0}Line | Count | Source | 244 | 73.3k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::Imports> as core::iter::traits::iterator::Iterator>::next::{closure#0}Line | Count | Source | 244 | 162k | 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 | 244 | 125k | 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 | 244 | 86.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 | 244 | 396k | 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 | 244 | 74.0k | 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 | 244 | 169k | 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 | 244 | 33.0k | 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 | 244 | 18.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 | 244 | 38.5k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<&str> as core::iter::traits::iterator::Iterator>::next::{closure#0}Line | Count | Source | 244 | 82.7k | Some(self.iter.next()?.map(|item| (pos, item))) |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<u32> as core::iter::traits::iterator::Iterator>::next::{closure#0}Line | Count | Source | 244 | 412k | Some(self.iter.next()?.map(|item| (pos, item))) |
|
245 | 3.40M | } Unexecuted instantiation: <wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::producers::ProducersFieldValue> as core::iter::traits::iterator::Iterator>::next 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::branch_hinting::BranchHintFunction> 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 | 242 | 68.1k | fn next(&mut self) -> Option<Self::Item> { | 243 | 68.1k | let pos = self.iter.section.reader.original_position(); | 244 | 68.1k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 68.1k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::MemoryType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 113k | fn next(&mut self) -> Option<Self::Item> { | 243 | 113k | let pos = self.iter.section.reader.original_position(); | 244 | 113k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 113k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::TagType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 50.7k | fn next(&mut self) -> Option<Self::Item> { | 243 | 50.7k | let pos = self.iter.section.reader.original_position(); | 244 | 50.7k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 50.7k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::types::RecGroup> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 321k | fn next(&mut self) -> Option<Self::Item> { | 243 | 321k | let pos = self.iter.section.reader.original_position(); | 244 | 321k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 321k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::tables::Table> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 52.1k | fn next(&mut self) -> Option<Self::Item> { | 243 | 52.1k | let pos = self.iter.section.reader.original_position(); | 244 | 52.1k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 52.1k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::exports::Export> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 244k | fn next(&mut self) -> Option<Self::Item> { | 243 | 244k | let pos = self.iter.section.reader.original_position(); | 244 | 244k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 244k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::globals::Global> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 264k | fn next(&mut self) -> Option<Self::Item> { | 243 | 264k | let pos = self.iter.section.reader.original_position(); | 244 | 264k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 264k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::ImportItemCompact> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 75.7k | fn next(&mut self) -> Option<Self::Item> { | 243 | 75.7k | let pos = self.iter.section.reader.original_position(); | 244 | 75.7k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 75.7k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::imports::Imports> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 189k | fn next(&mut self) -> Option<Self::Item> { | 243 | 189k | let pos = self.iter.section.reader.original_position(); | 244 | 189k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 189k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::core::elements::Element> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 133k | fn next(&mut self) -> Option<Self::Item> { | 243 | 133k | let pos = self.iter.section.reader.original_position(); | 244 | 133k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 133k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::canonicals::CanonicalFunction> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 127k | fn next(&mut self) -> Option<Self::Item> { | 243 | 127k | let pos = self.iter.section.reader.original_position(); | 244 | 127k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 127k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::types::ComponentType> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 579k | fn next(&mut self) -> Option<Self::Item> { | 243 | 579k | let pos = self.iter.section.reader.original_position(); | 244 | 579k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 579k | } |
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 | 242 | 120k | fn next(&mut self) -> Option<Self::Item> { | 243 | 120k | let pos = self.iter.section.reader.original_position(); | 244 | 120k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 120k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::exports::ComponentExport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 332k | fn next(&mut self) -> Option<Self::Item> { | 243 | 332k | let pos = self.iter.section.reader.original_position(); | 244 | 332k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 332k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::imports::ComponentImport> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 59.8k | fn next(&mut self) -> Option<Self::Item> { | 243 | 59.8k | let pos = self.iter.section.reader.original_position(); | 244 | 59.8k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 59.8k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::ComponentInstance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 36.7k | fn next(&mut self) -> Option<Self::Item> { | 243 | 36.7k | let pos = self.iter.section.reader.original_position(); | 244 | 36.7k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 36.7k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<wasmparser::readers::component::instances::Instance> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 69.2k | fn next(&mut self) -> Option<Self::Item> { | 243 | 69.2k | let pos = self.iter.section.reader.original_position(); | 244 | 69.2k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 69.2k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<&str> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 86.2k | fn next(&mut self) -> Option<Self::Item> { | 243 | 86.2k | let pos = self.iter.section.reader.original_position(); | 244 | 86.2k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 86.2k | } |
<wasmparser::readers::SectionLimitedIntoIterWithOffsets<u32> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 242 | 482k | fn next(&mut self) -> Option<Self::Item> { | 243 | 482k | let pos = self.iter.section.reader.original_position(); | 244 | 482k | Some(self.iter.next()?.map(|item| (pos, item))) | 245 | 482k | } |
|
246 | | |
247 | 0 | fn size_hint(&self) -> (usize, Option<usize>) { |
248 | 0 | self.iter.size_hint() |
249 | 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 |
250 | | } |
251 | | |
252 | | impl<'a, T> ExactSizeIterator for SectionLimitedIntoIterWithOffsets<'a, T> where T: FromReader<'a> {} |
253 | | |
254 | | /// A trait implemented for subsections of another outer section. |
255 | | /// |
256 | | /// This is currently only used for subsections within custom sections, such as |
257 | | /// the `name` section of core wasm. |
258 | | /// |
259 | | /// This is used in conjunction with [`Subsections`]. |
260 | | pub trait Subsection<'a>: Sized { |
261 | | /// Converts the section identifier provided with the section contents into |
262 | | /// a typed section |
263 | | fn from_reader(id: u8, reader: BinaryReader<'a>) -> Result<Self>; |
264 | | } |
265 | | |
266 | | /// Iterator/reader over the contents of a section which is composed of |
267 | | /// subsections. |
268 | | /// |
269 | | /// This reader is used for the core `name` section, for example. This type |
270 | | /// primarily implements [`Iterator`] for advancing through the sections. |
271 | | pub struct Subsections<'a, T> { |
272 | | reader: BinaryReader<'a>, |
273 | | _marker: marker::PhantomData<T>, |
274 | | } |
275 | | |
276 | | impl<'a, T> Subsections<'a, T> { |
277 | | /// Creates a new reader for the specified section contents starting at |
278 | | /// `offset` within the original wasm file. |
279 | 0 | pub fn new(reader: BinaryReader<'a>) -> Self { |
280 | 0 | Subsections { |
281 | 0 | reader, |
282 | 0 | _marker: marker::PhantomData, |
283 | 0 | } |
284 | 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 |
285 | | |
286 | | /// Returns whether the original byte offset of this section. |
287 | 0 | pub fn original_position(&self) -> u64 { |
288 | 0 | self.reader.original_position() |
289 | 0 | } Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::dylink0::Dylink0Subsection>>::original_position Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::names::Name>>::original_position Unexecuted instantiation: <wasmparser::readers::Subsections<wasmparser::readers::core::linking::Linking>>::original_position |
290 | | |
291 | | /// Returns the range, as byte offsets, of this section within the original |
292 | | /// wasm binary. |
293 | 0 | pub fn range(&self) -> Range<u64> { |
294 | 0 | self.reader.range() |
295 | 0 | } |
296 | | |
297 | 0 | fn read(&mut self) -> Result<T> |
298 | 0 | where |
299 | 0 | T: Subsection<'a>, |
300 | | { |
301 | 0 | let subsection_id = self.reader.read_u7()?; |
302 | 0 | let reader = self.reader.read_reader()?; |
303 | 0 | T::from_reader(subsection_id, reader) |
304 | 0 | } 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::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 |
305 | | } |
306 | | |
307 | | impl<T> Clone for Subsections<'_, T> { |
308 | 0 | fn clone(&self) -> Self { |
309 | 0 | Subsections { |
310 | 0 | reader: self.reader.clone(), |
311 | 0 | _marker: self._marker, |
312 | 0 | } |
313 | 0 | } |
314 | | } |
315 | | |
316 | | impl<T> fmt::Debug for Subsections<'_, T> { |
317 | 0 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
318 | 0 | f.debug_struct("Subsections") |
319 | 0 | .field("range", &self.range()) |
320 | 0 | .finish() |
321 | 0 | } |
322 | | } |
323 | | |
324 | | impl<'a, T> Iterator for Subsections<'a, T> |
325 | | where |
326 | | T: Subsection<'a>, |
327 | | { |
328 | | type Item = Result<T>; |
329 | | |
330 | 0 | fn next(&mut self) -> Option<Result<T>> { |
331 | 0 | if self.reader.eof() { |
332 | 0 | None |
333 | | } else { |
334 | 0 | Some(self.read()) |
335 | | } |
336 | 0 | } 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::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 |
337 | | } |