Struct wasm_encoder::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 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.

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.

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 T)

🔬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,

§

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>,

§

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>,

§

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.