pub struct CompileResult {
pub syntax: TranslationUnit,
pub modules: Vec<Module>,
pub sourcemap: Option<BasicSourceMap>,
pub used_items: UsedItems,
}Expand description
Result of Compiler::compile.
This type contains the resulting WGSL syntax tree, the sourcemap (if enabled), and the list of used modules/declarations.
It implements std::fmt::Display, call to_string() to get the compiled WGSL.
Fields§
§syntax: TranslationUnitThe syntax tree of the resulting
modules: Vec<Module>§sourcemap: Option<BasicSourceMap>§used_items: UsedItemsImplementations§
Source§impl CompileResult
impl CompileResult
Sourcepub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
pub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
Write the compiled result to a file.
Sourcepub fn emit_rerun_if_changed(&self)
pub fn emit_rerun_if_changed(&self)
Emit rerun-if-changed instructions so the build script reruns only if the
shader files are modified.
Sourcepub fn write_artifact(&self, artifact_name: &str)
pub fn write_artifact(&self, artifact_name: &str)
Write the result in rust’s OUT_DIR.
This function is meant to be used in a build.rs workflow. The output WGSL will
be accessed with the wesl_core::include_wesl macro. See the crate documentation for a
usage example.
§Panics
Panics when the output file cannot be written.
Trait Implementations§
Source§impl Clone for CompileResult
impl Clone for CompileResult
Source§fn clone(&self) -> CompileResult
fn clone(&self) -> CompileResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for CompileResult
impl Default for CompileResult
Source§fn default() -> CompileResult
fn default() -> CompileResult
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CompileResult
impl RefUnwindSafe for CompileResult
impl Send for CompileResult
impl Sync for CompileResult
impl Unpin for CompileResult
impl UnsafeUnpin for CompileResult
impl UnwindSafe for CompileResult
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
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> ⓘ
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