pub trait AddCustomEntries<K, V>
where 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 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§

source

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.

source

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.

Implementors§