ModuleSection

Enum ModuleSection 

Source
pub enum ModuleSection {
Show 13 variants Custom = 0, Type = 1, Import = 2, Function = 3, Table = 4, Memory = 5, Global = 6, Export = 7, Start = 8, Element = 9, Code = 10, Data = 11, DataCount = 12,
}
Expand description

The binary encoding of modules is organized into sections. Most sections correspond to one component of a module record, except that function definitions are split into two sections, separating their type declarations in the function section from their bodies in the code section.

See https://webassembly.github.io/spec/core/binary/modules.html

VariantsΒ§

Β§

Custom = 0

Custom sections have the id 0. They are intended to be used for debugging information or third-party extensions, and are ignored by the WebAssembly semantics. Their contents consist of a name further identifying the custom section, followed by an uninterpreted sequence of bytes for custom use.

Β§

Type = 1

The type section has the id 1. It decodes into a vector of function types that represent the π—π—’π—‰π–Ύπ—Œ component of a module.

Β§

Import = 2

The import section has the id 2. It decodes into a vector of imports that represent the π—‚π—†π—‰π—ˆπ—‹π—π—Œ component of a module.

Β§

Function = 3

The function section has the id 3. It decodes into a vector of type indices that represent the 𝗍𝗒𝗉𝖾 fields of the functions in the π–Ώπ—Žπ—‡π–Όπ—Œ component of a module. The π—…π—ˆπ–Όπ–Ίπ—…π—Œ and π–»π—ˆπ–½π—’ fields of the respective functions are encoded separately in the code section.

Β§

Table = 4

The table section has the id 4. It decodes into a vector of tables that represent the π—π–Ίπ–»π—…π–Ύπ—Œ component of a module.

Β§

Memory = 5

The memory section has the id 5. It decodes into a vector of memories that represent the π—†π–Ύπ—†π—Œ component of a module.

Β§

Global = 6

The global section has the id 6. It decodes into a vector of globals that represent the π—€π—…π—ˆπ–»π–Ίπ—…π—Œ component of a module.

Β§

Export = 7

The export section has the id 7. It decodes into a vector of exports that represent the π–Ύπ—‘π—‰π—ˆπ—‹π—π—Œ component of a module.

Β§

Start = 8

The start section has the id 8. It decodes into an optional start function that represents the π—Œπ—π–Ίπ—‹π— component of a module.

Β§

Element = 9

The element section has the id 9. It decodes into a vector of element segments that represent the π–Ύπ—…π–Ύπ—†π—Œ component of a module.

Β§

Code = 10

The code section has the id 10. It decodes into a vector of code entries that are pairs of value type vectors and expressions. They represent the π—…π—ˆπ–Όπ–Ίπ—…π—Œ and π–»π—ˆπ–½π—’ field of the functions in the π–Ώπ—Žπ—‡π–Όπ—Œ component of a module. The 𝗍𝗒𝗉𝖾 fields of the respective functions are encoded separately in the function section.

Β§

Data = 11

The data section has the id 11. It decodes into a vector of data segments that represent the π–½π–Ίπ—π–Ίπ—Œ component of a module.

Β§

DataCount = 12

The data count section has the id 12. It decodes into an optional u32 that represents the number of data segments in the data section. If this count does not match the length of the data segment vector, the module is malformed.

Trait ImplementationsΒ§

SourceΒ§

impl Clone for ModuleSection

SourceΒ§

fn clone(&self) -> ModuleSection

Returns a duplicate of the value. Read more
1.0.0 Β· SourceΒ§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
SourceΒ§

impl Debug for ModuleSection

SourceΒ§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
SourceΒ§

impl Hash for ModuleSection

SourceΒ§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 Β· SourceΒ§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
SourceΒ§

impl Ord for ModuleSection

SourceΒ§

fn cmp(&self, other: &ModuleSection) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 Β· SourceΒ§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 Β· SourceΒ§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 Β· SourceΒ§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
SourceΒ§

impl PartialEq for ModuleSection

SourceΒ§

fn eq(&self, other: &ModuleSection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 Β· SourceΒ§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
SourceΒ§

impl PartialOrd for ModuleSection

SourceΒ§

fn partial_cmp(&self, other: &ModuleSection) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 Β· SourceΒ§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 Β· SourceΒ§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 Β· SourceΒ§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 Β· SourceΒ§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
SourceΒ§

impl Copy for ModuleSection

SourceΒ§

impl Eq for ModuleSection

SourceΒ§

impl StructuralPartialEq for ModuleSection

Auto Trait ImplementationsΒ§

Blanket ImplementationsΒ§

SourceΒ§

impl<T> Any for T
where T: 'static + ?Sized,

SourceΒ§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
SourceΒ§

impl<T> Borrow<T> for T
where T: ?Sized,

SourceΒ§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
SourceΒ§

impl<T> BorrowMut<T> for T
where T: ?Sized,

SourceΒ§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
SourceΒ§

impl<T> CloneToUninit for T
where T: Clone,

SourceΒ§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

πŸ”¬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
SourceΒ§

impl<T> From<T> for T

SourceΒ§

fn from(t: T) -> T

Returns the argument unchanged.

SourceΒ§

impl<T, U> Into<U> for T
where U: From<T>,

SourceΒ§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

SourceΒ§

impl<T> ToOwned for T
where T: Clone,

SourceΒ§

type Owned = T

The resulting type after obtaining ownership.
SourceΒ§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
SourceΒ§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
SourceΒ§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

SourceΒ§

type Error = Infallible

The type returned in the event of a conversion error.
SourceΒ§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
SourceΒ§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

SourceΒ§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
SourceΒ§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.