Trait vergen_lib::AddCustomEntries
source · pub trait AddCustomEntries<K: Into<String> + Ord, V: Into<String>> {
// Required methods
fn add_calculated_entries(
&self,
idempotent: bool,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning
) -> Result<()>;
fn add_default_entries(
&self,
config: &DefaultConfig,
cargo_rustc_env_map: &mut BTreeMap<K, V>,
cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning
) -> Result<()>;
}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 CargoRerunIfChanged,
cargo_warning: &mut CargoWarning
) -> Result<()>
fn add_calculated_entries( &self, idempotent: bool, cargo_rustc_env_map: &mut BTreeMap<K, V>, cargo_rerun_if_changed: &mut CargoRerunIfChanged, cargo_warning: &mut CargoWarning ) -> Result<()>
Try to add instructions entries to the various given arguments.
- Write to the
cargo_rustc_envmap to emit ‘cargo:rustc-env=NAME=VALUE’ instructions. - Write to the
cargo_rerun_if_changedvector to emit ‘cargo:rerun-if-changed=VALUE’ instructions. - Write to the
cargo_warningvector 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 CargoRerunIfChanged,
cargo_warning: &mut CargoWarning
) -> Result<()>
fn add_default_entries( &self, config: &DefaultConfig, cargo_rustc_env_map: &mut BTreeMap<K, V>, cargo_rerun_if_changed: &mut CargoRerunIfChanged, cargo_warning: &mut CargoWarning ) -> Result<()>
Based on the given configuration, emit either default idempotent output or generate a failue.
- Write to the
cargo_rustc_envmap to emit ‘cargo:rustc-env=NAME=VALUE’ instructions. - Write to the
cargo_rerun_if_changedvector to emit ‘cargo:rerun-if-changed=VALUE’ instructions. - Write to the
cargo_warningvector to emit ‘cargo:warning=VALUE’ instructions.
§Errors
This assumes generating instructions may fail in some manner so a anyhow::Result is returned.