Struct BuildScriptConfig

Source
#[non_exhaustive]
pub struct BuildScriptConfig { pub defaults: bool, pub dependency_info: Option<bool>, pub env_shader_spv_path: Option<bool>, pub forward_rustc_warnings: Option<bool>, pub cargo_color_always: Option<bool>, }
Expand description

Configuration for build scripts

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§defaults: bool

Enable this if you are using spirv-builder from a build script to apply some recommended default options, such as Self::dependency_info, Self::forward_rustc_warnings and Self::cargo_color_always.

§dependency_info: Option<bool>

Print dependency information for cargo build scripts (with cargo::rerun-if-changed={} and such). Dependency information makes cargo rerun the build script is rerun when shader source files change, thus rebuilding the shader.

Default: Self::defaults

§env_shader_spv_path: Option<bool>

Whether to emit an env var pointing to the shader module file (via cargo::rustc-env={}). The name of the env var is the crate name with .spv appended, e.g. sky_shader.spv. Not supported together with multimodule=true.

Some examples on how to include the shader module in the source code:

  • wgpu:
let shader: ShaderModuleDescriptorPassthrough = include_spirv_raw!(env!("my_shader.spv"));
  • ash
let bytes: &[u8] = include_bytes!(env!("my_shader.spv"))
let words = ash::util::read_spv(&mut std::io::Cursor::new(bytes)).unwrap();

Default: false

§forward_rustc_warnings: Option<bool>

Forwards any warnings or errors by rustc as build script warnings (via cargo::warning=). Not enabling this option may hide warnings if the build succeeds.

Default: Self::defaults

§cargo_color_always: Option<bool>

Pass --color always to cargo to force enable colorful error messages. Particularly in build scripts, these are disabled by default, even though we’ll forward them to your console. Should your console not support colors, then the outer cargo executing the build script will filter out all ansi escape sequences anyway, so we’re free to always emit them.

Default: Self::defaults

Trait Implementations§

Source§

impl Clone for BuildScriptConfig

Source§

fn clone(&self) -> BuildScriptConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BuildScriptConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BuildScriptConfig

Source§

fn default() -> BuildScriptConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.