pub struct Shadow {
pub f: File,
pub map: BTreeMap<ShadowConst, ConstVal>,
pub std_env: BTreeMap<String, String>,
pub deny_const: BTreeSet<ShadowConst>,
}
Expand description
shadow-rs
configuration.
If you use the recommended utility functions new
, new_deny
, or new_hook
, you do not have to handle Shadow
configurations themselves.
However, this struct provides more fine-grained access to shadow-rs
configuration, such as using a denylist and a hook function at the same time.
Fields§
§f: File
The file that shadow-rs
writes build information to.
map: BTreeMap<ShadowConst, ConstVal>
The values of build constants to be written.
std_env: BTreeMap<String, String>
Build environment variables, obtained through std::env::vars
.
deny_const: BTreeSet<ShadowConst>
Constants in the denylist, passed through new_deny
or Shadow::build
.
Implementations§
source§impl Shadow
impl Shadow
sourcepub fn hook<F>(&self, f: F) -> SdResult<()>
pub fn hook<F>(&self, f: F) -> SdResult<()>
Write the build configuration specified by this Shadow
instance.
The hook function is run as well, allowing it to append to shadow-rs
’s output.
sourcepub fn build(deny_const: BTreeSet<ShadowConst>) -> SdResult<Shadow>
pub fn build(deny_const: BTreeSet<ShadowConst>) -> SdResult<Shadow>
Create a new Shadow
configuration with a provided denylist.
The project source path and output file are automatically derived from Cargo build environment variables.
pub fn build_with( src_path: String, out_path: String, deny_const: BTreeSet<ShadowConst>, ) -> SdResult<Shadow>
sourcepub fn cargo_rerun_if_env_changed(&self)
pub fn cargo_rerun_if_env_changed(&self)
Request Cargo to re-run the build script if any environment variable observed by this Shadow
configuration changes.
sourcepub fn cargo_rerun_env_inject(&self, env: &[&str])
pub fn cargo_rerun_env_inject(&self, env: &[&str])
Request Cargo to re-run the build script if any of the specified environment variables change.
This function is not influenced by this Shadow
configuration.