Struct substrate_wasm_builder::WasmBuilder[][src]

pub struct WasmBuilder { /* fields omitted */ }
Expand description

The builder for building a wasm binary.

The builder itself is separated into multiple structs to make the setup type safe.

Building a wasm binary:

  1. Call WasmBuilder::new to create a new builder.
  2. Select the project to build using the methods of WasmBuilderSelectProject.
  3. Set additional RUST_FLAGS or a different name for the file containing the WASM code using methods of WasmBuilder.
  4. Build the WASM binary using Self::build.

Implementations

Create a new instance of the builder.

Enable exporting __heap_base as global variable in the WASM binary.

This adds -Clink-arg=--export=__heap_base to RUST_FLAGS.

Set the name of the file that will be generated in OUT_DIR.

This file needs to be included to get access to the build WASM binary.

If this function is not called, file_name defaults to wasm_binary.rs

Instruct the linker to import the memory into the WASM binary.

This adds -C link-arg=--import-memory to RUST_FLAGS.

Append the given flag to RUST_FLAGS.

flag is appended as is, so it needs to be a valid flag.

Enable the given feature when building the wasm binary.

feature needs to be a valid feature that is defined in the project Cargo.toml.

Build the WASM binary.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.