Struct wasm_builder_runner::WasmBuilder [−][src]
The builder for building a wasm binary.
The builder itself is seperated into multiple structs to make the setup type safe.
Building a wasm binary:
- Call
WasmBuilder::new
to create a new builder. - Select the project to build using the methods of
WasmBuilderSelectProject
. - Select the source of the
wasm-builder
crate using the methods ofWasmBuilderSelectSource
. - Set additional
RUST_FLAGS
or a different name for the file containing the WASM code using methods ofSelf
. - Build the WASM binary using
Self::build
.
Implementations
impl WasmBuilder
[src]
pub fn new() -> WasmBuilderSelectProject
[src]
Create a new instance of the builder.
pub fn export_heap_base(self) -> Self
[src]
Enable exporting __heap_base
as global variable in the WASM binary.
This adds -Clink-arg=--export=__heap_base
to RUST_FLAGS
.
pub fn set_file_name(self, file_name: impl Into<String>) -> Self
[src]
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
pub fn import_memory(self) -> Self
[src]
Instruct the linker to import the memory into the WASM binary.
This adds -C link-arg=--import-memory
to RUST_FLAGS
.
pub fn append_to_rust_flags(self, flag: impl Into<String>) -> Self
[src]
Append the given flag
to RUST_FLAGS
.
flag
is appended as is, so it needs to be a valid flag.
pub fn build(self)
[src]
Build the WASM binary.
Auto Trait Implementations
impl RefUnwindSafe for WasmBuilder
impl Send for WasmBuilder
impl Sync for WasmBuilder
impl Unpin for WasmBuilder
impl UnwindSafe for WasmBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,