pub struct CompileOptions {Show 15 fields
pub imports: bool,
pub condcomp: bool,
pub visibility: bool,
pub generics: bool,
pub strip: bool,
pub lower: bool,
pub validate: bool,
pub sourcemap: bool,
pub mangler: ManglerKind,
pub mangle_main: bool,
pub keep: Option<Vec<String>>,
pub keep_main: bool,
pub features: Features,
pub constants: Constants,
pub dependencies: Vec<&'static StaticPackage>,
}Expand description
Compilation options used by Compiler.
Fields§
§imports: boolToggle WESL Imports.
If disabled:
- The compiler will silently remove all import statements and inline paths.
- Validation will not trigger an error if referencing an imported item.
condcomp: boolToggle WESL Conditional Translation.
See Self::features to enable/disable each feature flag.
visibility: boolToggle WESL Visibility
When disabled, WESL simply ignores public and private keywords on declarations and treats
all declarations as public.
generics: boolToggle generics. Generics are super experimental, don’t expect anything from it.
Requires the generics crate feature flag.
strip: boolEnable stripping (aka. Dead Code Elimination).
By default, all declarations reachable by entrypoint functions, const_asserts and
pipeline-overridable constants in the main module are kept.
See Self::keep and Self::keep_main to control what gets stripped.
Stripping can have side-effects: modules are loaded only if statically accessed,
and const_assert statements are not always preserved.
Refer to the WESL docs to learn more.
lower: boolEnable lowering/polyfills. This transforms the output code in various ways.
See pass::lower for the list of transforms.
validate: boolEnable validation of individual WESL modules and of the final output.
This will catch some errors, not all.
See pass::validate_wesl and pass::validate_wgsl for the list of validations.
Requires the eval crate feature flag.
sourcemap: boolEnable sourcemapping, which provides better error diagnostics.
mangler: ManglerKindDeclaration name mangling scheme.
mangle_main: boolEnable mangling of declarations in the main module.
By default, WESL does not mangle main module declarations.
keep: Option<Vec<String>>If Some, specify a list of main module declarations to keep.
If None, only the entrypoint functions (and their dependencies) are kept.
This option has no effect if Self::keep_main is enabled or Self::strip is
disabled.
keep_main: boolIf true, all main module declarations are preserved when stripping is enabled.
This option takes precedence over Self::keep, and has no effect if
Self::strip is disabled.
features: FeaturesConditional Translation feature flags.
This option has no effect if Self::condcomp is disabled.
See Features.
constants: ConstantsLiteral constants in the constants virtual module.
See Constants.
dependencies: Vec<&'static StaticPackage>Importable packages dependencies.
Trait Implementations§
Source§impl Clone for CompileOptions
impl Clone for CompileOptions
Source§fn clone(&self) -> CompileOptions
fn clone(&self) -> CompileOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompileOptions
impl Debug for CompileOptions
Source§impl Default for CompileOptions
impl Default for CompileOptions
Source§impl PartialEq for CompileOptions
impl PartialEq for CompileOptions
impl StructuralPartialEq for CompileOptions
Auto Trait Implementations§
impl Freeze for CompileOptions
impl RefUnwindSafe for CompileOptions
impl Send for CompileOptions
impl Sync for CompileOptions
impl Unpin for CompileOptions
impl UnsafeUnpin for CompileOptions
impl UnwindSafe for CompileOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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