Struct wasm_encoder::GlobalSection 
source · [−]pub struct GlobalSection { /* private fields */ }Expand description
An encoder for the global section.
Global sections are only supported for modules.
Example
use wasm_encoder::{Module, GlobalSection, GlobalType, Instruction, ValType};
let mut globals = GlobalSection::new();
globals.global(
    GlobalType {
        val_type: ValType::I32,
        mutable: false,
    },
    &Instruction::I32Const(42),
);
let mut module = Module::new();
module.section(&globals);
let wasm_bytes = module.finish();Implementations
sourceimpl GlobalSection
 
impl GlobalSection
sourcepub fn global(
    &mut self, 
    global_type: GlobalType, 
    init_expr: &Instruction<'_>
) -> &mut Self
 
pub fn global(
    &mut self, 
    global_type: GlobalType, 
    init_expr: &Instruction<'_>
) -> &mut Self
Define a global.
Trait Implementations
sourceimpl Clone for GlobalSection
 
impl Clone for GlobalSection
sourcefn clone(&self) -> GlobalSection
 
fn clone(&self) -> GlobalSection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for GlobalSection
 
impl Debug for GlobalSection
sourceimpl Default for GlobalSection
 
impl Default for GlobalSection
sourcefn default() -> GlobalSection
 
fn default() -> GlobalSection
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for GlobalSection
impl Send for GlobalSection
impl Sync for GlobalSection
impl Unpin for GlobalSection
impl UnwindSafe for GlobalSection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
    T: Clone, 
 
impl<T> ToOwned for T where
    T: Clone, 
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
 
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more