pub trait AddEntries {
// Required methods
fn add_map_entries(
&self,
idempotent: bool,
cargo_rustc_env: &mut CargoRustcEnvMap,
cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning,
) -> Result<()>;
fn add_default_entries(
&self,
config: &DefaultConfig,
cargo_rustc_env_map: &mut CargoRustcEnvMap,
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 instructions for your feature.
Required Methods§
Sourcefn add_map_entries(
&self,
idempotent: bool,
cargo_rustc_env: &mut CargoRustcEnvMap,
cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning,
) -> Result<()>
fn add_map_entries( &self, idempotent: bool, cargo_rustc_env: &mut CargoRustcEnvMap, 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_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 CargoRustcEnvMap,
cargo_rerun_if_changed: &mut CargoRerunIfChanged,
cargo_warning: &mut CargoWarning,
) -> Result<()>
fn add_default_entries( &self, config: &DefaultConfig, cargo_rustc_env_map: &mut CargoRustcEnvMap, 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_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.