Debian Codegraph @

crates/wasmparser/src/readers/core/imports.rs

raw symbols SCIP
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 craterust-analyzer cargo wasmparser 0.239.0 crate/::{
17 BinaryReaderrust-analyzer cargo wasmparser 0.239.0 binary_reader/BinaryReader#, ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#, FromReaderrust-analyzer cargo wasmparser 0.239.0 readers/FromReader#, GlobalTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/GlobalType#, MemoryTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/MemoryType#, Resultrust-analyzer cargo wasmparser 0.239.0 binary_reader/Result#, SectionLimitedrust-analyzer cargo wasmparser 0.239.0 readers/SectionLimited#,
18 TableTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/TableType#, TagTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/TagType#,
19 };
20
21 /// Represents a reference to a type definition in a WebAssembly module.
22 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
23 pub enum TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef# {
24 /// The type is a function.
25 ///
26 /// The value is an index into the type section.
27 Funcrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Func#(u32),
28 /// The type is a table.
29 Tablerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Table#(TableTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/TableType#),
30 /// The type is a memory.
31 Memoryrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Memory#(MemoryTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/MemoryType#),
32 /// The type is a global.
33 Globalrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Global#(GlobalTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/GlobalType#),
34 /// The type is a tag.
35 ///
36 /// This variant is only used for the exception handling proposal.
37 ///
38 /// The value is an index in the types index space.
39 Tagrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Tag#(TagTyperust-analyzer cargo wasmparser 0.239.0 readers/core/types/TagType#),
40 }
41
42 /// Represents an import in a WebAssembly module.
43 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
44 pub struct Importrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#<'a> {
45 /// The module being imported from.
46 pub modulerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#module.: &'a str,
47 /// The name of the imported item.
48 pub namerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#name.: &'a str,
49 /// The type of the imported item.
50 pub tyrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#ty.: TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#,
51 }
52
53 /// A reader for the import section of a WebAssembly module.
54 pub type ImportSectionReaderrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/ImportSectionReader#<'a> = SectionLimitedrust-analyzer cargo wasmparser 0.239.0 readers/SectionLimited#<'a, Importrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#<'a>>;
55
56 impl<'a> FromReaderrust-analyzer cargo wasmparser 0.239.0 readers/FromReader#<'a> for Importrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#<'a> {
57 fn from_readerrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/impl#[`Import<'a>`][`FromReader<'a>`]from_reader().(reader: &mut BinaryReaderrust-analyzer cargo wasmparser 0.239.0 binary_reader/BinaryReader#<'a>) -> Resultrust-analyzer cargo wasmparser 0.239.0 binary_reader/Result#<Selfrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/impl#[`Import<'a>`][`FromReader<'a>`]> {
58 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Importrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import# {
59 modulerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#module.: reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
60 namerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#name.: reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
61 tyrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/Import#ty.: reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
62 })
63 }
64 }
65
66 impl<'a> FromReaderrust-analyzer cargo wasmparser 0.239.0 readers/FromReader#<'a> for TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef# {
67 fn from_readerrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/impl#[TypeRef][`FromReader<'a>`]from_reader().(reader: &mut BinaryReaderrust-analyzer cargo wasmparser 0.239.0 binary_reader/BinaryReader#<'a>) -> Resultrust-analyzer cargo wasmparser 0.239.0 binary_reader/Result#<Selfrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/impl#[TypeRef][`FromReader<'a>`]> {
68 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
69 ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#::Funcrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#Func# => TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#::Funcrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Func#(reader.read_var_u32rust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read_var_u32().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
70 ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#::Tablerust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#Table# => TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#::Tablerust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Table#(reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
71 ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#::Memoryrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#Memory# => TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#::Memoryrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Memory#(reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
72 ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#::Globalrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#Global# => TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#::Globalrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Global#(reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
73 ExternalKindrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#::Tagrust-analyzer cargo wasmparser 0.239.0 readers/core/exports/ExternalKind#Tag# => TypeRefrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#::Tagrust-analyzer cargo wasmparser 0.239.0 readers/core/imports/TypeRef#Tag#(reader.readrust-analyzer cargo wasmparser 0.239.0 binary_reader/impl#[`BinaryReader<'a>`]read().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().),
74 })
75 }
76 }