wasm_encoder

Struct SymbolTable

Source
pub struct SymbolTable { /* private fields */ }
Expand description

A subsection of the linking custom section that provides extra information about the symbols present in this Wasm object file.

Implementations§

Source§

impl SymbolTable

Source

pub const WASM_SYM_BINDING_WEAK: u32 = 1u32

This is a weak symbol.

This flag is mutually exclusive with WASM_SYM_BINDING_LOCAL.

When linking multiple modules defining the same symbol, all weak definitions are discarded if any strong definitions exist; then if multiple weak definitions exist all but one (unspecified) are discarded; and finally it is an error if more than one definition remains.

Source

pub const WASM_SYM_BINDING_LOCAL: u32 = 2u32

This is a local symbol.

This flag is mutually exclusive with WASM_SYM_BINDING_WEAK.

Local symbols are not to be exported, or linked to other modules/sections. The names of all non-local symbols must be unique, but the names of local symbols are not considered for uniqueness. A local function or global symbol cannot reference an import.

Source

pub const WASM_SYM_VISIBILITY_HIDDEN: u32 = 4u32

This is a hidden symbol.

Hidden symbols are not to be exported when performing the final link, but may be linked to other modules.

Source

pub const WASM_SYM_UNDEFINED: u32 = 16u32

This symbol is not defined.

For non-data symbols, this must match whether the symbol is an import or is defined; for data symbols, determines whether a segment is specified.

Source

pub const WASM_SYM_EXPORTED: u32 = 32u32

This symbol is intended to be exported from the wasm module to the host environment.

This differs from the visibility flags in that it effects the static linker.

Source

pub const WASM_SYM_EXPLICIT_NAME: u32 = 64u32

This symbol uses an explicit symbol name, rather than reusing the name from a wasm import.

This allows it to remap imports from foreign WebAssembly modules into local symbols with different names.

Source

pub const WASM_SYM_NO_STRIP: u32 = 128u32

This symbol is intended to be included in the linker output, regardless of whether it is used by the program.

Source

pub fn new() -> Self

Construct a new symbol table subsection encoder.

Source

pub fn function( &mut self, flags: u32, index: u32, name: Option<&str>, ) -> &mut Self

Define a function symbol in this symbol table.

The name must be omitted if index references an imported table and the WASM_SYM_EXPLICIT_NAME flag is not set.

Source

pub fn global( &mut self, flags: u32, index: u32, name: Option<&str>, ) -> &mut Self

Define a global symbol in this symbol table.

The name must be omitted if index references an imported table and the WASM_SYM_EXPLICIT_NAME flag is not set.

Source

pub fn table(&mut self, flags: u32, index: u32, name: Option<&str>) -> &mut Self

Define a table symbol in this symbol table.

The name must be omitted if index references an imported table and the WASM_SYM_EXPLICIT_NAME flag is not set.

Source

pub fn data( &mut self, flags: u32, name: &str, definition: Option<DataSymbolDefinition>, ) -> &mut Self

Add a data symbol to this symbol table.

Trait Implementations§

Source§

impl Clone for SymbolTable

Source§

fn clone(&self) -> SymbolTable

Returns a copy 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 SymbolTable

Source§

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

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

impl Default for SymbolTable

Source§

fn default() -> SymbolTable

Returns the “default value” for a type. Read more
Source§

impl Encode for SymbolTable

Source§

fn encode(&self, sink: &mut Vec<u8>)

Encode the type into the given byte sink.

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.