pub struct WasmBuildConfig {
pub language: Option<WasmLanguage>,
pub target: WasiTarget,
pub optimize: bool,
pub opt_level: String,
pub wit_path: Option<PathBuf>,
pub output_path: Option<PathBuf>,
pub world: Option<String>,
pub features: Vec<String>,
pub build_args: HashMap<String, String>,
pub pre_build: Vec<Vec<String>>,
pub post_build: Vec<Vec<String>>,
pub adapter: Option<PathBuf>,
}Expand description
Configuration for building a WASM component
Fields§
§language: Option<WasmLanguage>Source language (None = auto-detect)
target: WasiTargetTarget WASI version
optimize: boolWhether to optimize the output with wasm-opt (release mode)
opt_level: StringOptimization level for wasm-opt (default: “Oz”)
wit_path: Option<PathBuf>Path to WIT files for component model
output_path: Option<PathBuf>Override output path
world: Option<String>Target WIT world name (e.g., “zlayer-http-handler”)
features: Vec<String>Language-specific features to enable
build_args: HashMap<String, String>Additional build arguments
pre_build: Vec<Vec<String>>Pre-build commands to run
post_build: Vec<Vec<String>>Post-build commands to run after compilation
adapter: Option<PathBuf>Component adapter path for WASI preview1 -> preview2 lifting
Implementations§
Source§impl WasmBuildConfig
impl WasmBuildConfig
Sourcepub fn language(self, lang: WasmLanguage) -> Self
pub fn language(self, lang: WasmLanguage) -> Self
Set the source language
Sourcepub fn target(self, target: WasiTarget) -> Self
pub fn target(self, target: WasiTarget) -> Self
Set the WASI target
Sourcepub fn output_path(self, path: impl Into<PathBuf>) -> Self
pub fn output_path(self, path: impl Into<PathBuf>) -> Self
Set the output path
Sourcepub fn opt_level(self, level: impl Into<String>) -> Self
pub fn opt_level(self, level: impl Into<String>) -> Self
Set the optimization level for wasm-opt
Sourcepub fn build_args(self, args: HashMap<String, String>) -> Self
pub fn build_args(self, args: HashMap<String, String>) -> Self
Set additional build arguments
Sourcepub fn post_build(self, commands: Vec<Vec<String>>) -> Self
pub fn post_build(self, commands: Vec<Vec<String>>) -> Self
Set post-build commands
Trait Implementations§
Source§impl Clone for WasmBuildConfig
impl Clone for WasmBuildConfig
Source§fn clone(&self) -> WasmBuildConfig
fn clone(&self) -> WasmBuildConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WasmBuildConfig
impl Debug for WasmBuildConfig
Auto Trait Implementations§
impl Freeze for WasmBuildConfig
impl RefUnwindSafe for WasmBuildConfig
impl Send for WasmBuildConfig
impl Sync for WasmBuildConfig
impl Unpin for WasmBuildConfig
impl UnsafeUnpin for WasmBuildConfig
impl UnwindSafe for WasmBuildConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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