pub struct RunWasm { /* private fields */ }
Expand description
Low level control over run-wasm for integration within your own custom xtask
When run()
is called it will:
- Compile the rust project to wasm
- Run wasm-bindgen
- Generate an index.html that runs the wasm
- Launch a tiny webserver to serve index.html + your wasm
It will block forever to keep the webserver running until killed with ctrl-c or similar
Implementations§
Source§impl RunWasm
impl RunWasm
pub fn new() -> Self
Sourcepub fn with_css(self, css: &str) -> Self
pub fn with_css(self, css: &str) -> Self
css to include on the served webpage. By default no css is included, which results in the default webpage styling which includes margins around the body. It is common to want a fullscreen wasm gui with no webpage margins which can be achieved via:
RunWasm::new()
.with_css("body { margin: 0px; }")
.run();
Sourcepub fn with_package(self, package: Option<String>) -> Self
pub fn with_package(self, package: Option<String>) -> Self
Package with the target to run
Sourcepub fn with_example(self, example: Option<String>) -> Self
pub fn with_example(self, example: Option<String>) -> Self
Name of the example target to run
Sourcepub fn with_profile(self, profile: Option<String>) -> Self
pub fn with_profile(self, profile: Option<String>) -> Self
Build artifacts with the specified profile
pub fn with_cargo_build_args(self, cargo_build_args: Vec<String>) -> Self
Sourcepub fn with_build_only(self, build_only: bool) -> Self
pub fn with_build_only(self, build_only: bool) -> Self
Only build the WASM artifacts, do not run the dev server
Sourcepub fn with_host(self, host: Option<String>) -> Self
pub fn with_host(self, host: Option<String>) -> Self
Makes the dev server listen on host (default ‘localhost’)
Auto Trait Implementations§
impl Freeze for RunWasm
impl RefUnwindSafe for RunWasm
impl Send for RunWasm
impl Sync for RunWasm
impl Unpin for RunWasm
impl UnwindSafe for RunWasm
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more