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
impl SymbolTable
sourcepub fn function(
&mut self,
flags: u32,
index: u32,
name: Option<&str>,
) -> &mut Self
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.
sourcepub fn global(
&mut self,
flags: u32,
index: u32,
name: Option<&str>,
) -> &mut Self
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.
sourcepub fn table(&mut self, flags: u32, index: u32, name: Option<&str>) -> &mut Self
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.
sourcepub fn data(
&mut self,
flags: u32,
name: &str,
definition: Option<DataSymbolDefinition>,
) -> &mut Self
pub fn data( &mut self, flags: u32, name: &str, definition: Option<DataSymbolDefinition>, ) -> &mut Self
Add a data symbol to this symbol table.
sourcepub const WASM_SYM_BINDING_WEAK: u32 = 1u32
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.
sourcepub const WASM_SYM_BINDING_LOCAL: u32 = 2u32
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.
sourcepub const WASM_SYM_VISIBILITY_HIDDEN: u32 = 4u32
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.
sourcepub const WASM_SYM_UNDEFINED: u32 = 16u32
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.
sourcepub const WASM_SYM_EXPORTED: u32 = 32u32
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.
sourcepub const WASM_SYM_EXPLICIT_NAME: u32 = 64u32
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.
sourcepub const WASM_SYM_NO_STRIP: u32 = 128u32
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
impl Clone for SymbolTable
source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SymbolTable
impl Debug for SymbolTable
source§impl Default for SymbolTable
impl Default for SymbolTable
source§fn default() -> SymbolTable
fn default() -> SymbolTable
Auto Trait Implementations§
impl Freeze for SymbolTable
impl RefUnwindSafe for SymbolTable
impl Send for SymbolTable
impl Sync for SymbolTable
impl Unpin for SymbolTable
impl UnwindSafe for SymbolTable
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)