Trait vergen::AddCustomEntries
source · pub trait AddCustomEntries<K, V>{
// Required methods
fn add_calculated_entries(
&self,
idempotent: bool,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>
) -> Result<(), Error>;
fn add_default_entries(
&self,
config: &DefaultConfig,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>
) -> Result<(), Error>;
}
Expand description
This trait should be implemented to allow the vergen
emitter to properly emit your custom instructions.
Required Methods§
sourcefn add_calculated_entries(
&self,
idempotent: bool,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>
) -> Result<(), Error>
fn add_calculated_entries( &self, idempotent: bool, cargo_rustc_env_map: &mut BTreeMap<K, V>, cargo_rerun_if_changed: &mut Vec<String>, cargo_warning: &mut Vec<String> ) -> Result<(), Error>
Try to add instructions entries to the various given arguments.
- Write to the
cargo_rustc_env
map to emit ‘cargo:rustc-env=NAME=VALUE’ instructions. - Write to the
cargo_rerun_if_changed
vector to emit ‘cargo:rerun-if-changed=VALUE’ instructions. - Write to the
cargo_warning
vector to emit ‘cargo:warning=VALUE’ instructions.
§Errors
If an error occurs, the vergen
emitter will use add_default_entries
to generate output.
This assumes generating instructions may fail in some manner so a anyhow::Result
is returned.
sourcefn add_default_entries(
&self,
config: &DefaultConfig,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut Vec<String>,
cargo_warning: &mut Vec<String>
) -> Result<(), Error>
fn add_default_entries( &self, config: &DefaultConfig, cargo_rustc_env_map: &mut BTreeMap<K, V>, cargo_rerun_if_changed: &mut Vec<String>, cargo_warning: &mut Vec<String> ) -> Result<(), Error>
Based on the given configuration, emit either default idempotent output or generate a failue.
- Write to the
cargo_rustc_env
map to emit ‘cargo:rustc-env=NAME=VALUE’ instructions. - Write to the
cargo_rerun_if_changed
vector to emit ‘cargo:rerun-if-changed=VALUE’ instructions. - Write to the
cargo_warning
vector to emit ‘cargo:warning=VALUE’ instructions.
§Errors
This assumes generating instructions may fail in some manner so a anyhow::Result
is returned.