[−][src]Crate cargo_emit
Talk to Cargo easily at build time, brought to you by Nikolai Vazquez.
This library provides:
-
Convenience macros for communicating with Cargo during the
build.rs
phrase. Cargo listens to certain build script outputs that dictate how it should behave. -
An accessible location for seeing what script build outputs are available to emit.
-
Protection against typos that can be made when printing these formatted outputs directly yourself. Mistyping macro names will result in a compile failure.
Usage
This crate is available on crates.io and can be used by adding the
following to your project's Cargo.toml
:
[build-dependencies]
cargo-emit = "0.1"
and something like this to your build.rs
:
if should_warn { cargo_emit::warning!("(C-3PO voice) We're doomed"); }
Note: This library is meant to be used with Rust 2018 edition,
so that cargo_emit::
can be used to prefix macro calls.
Compatibility
This crate is compatible with Rust 1.31+ in order to use the
$crate::macro!
feature introduced in Rust 2018.
Examples
Very thorough examples are provided in the docs for each individual macro.
Donate
This project is made freely available (as in free beer), but unfortunately not all beer is free! So, if you would like to buy me a beer (or coffee or more), then consider supporting my work that's benefited your project and thousands of others.
Macros
pair | Emits a |
rerun_if_changed | Tells Cargo to run again if the file or directory at |
rerun_if_env_changed | Tells Cargo to run again if the file or directory at |
rustc_cdylib_link_arg | Tells Cargo to pass |
rustc_cfg | Tells Cargo to enable a |
rustc_env | Tells Cargo to assign |
rustc_flags | Tells Cargo to pass |
rustc_link_lib | Tells Cargo to pass |
rustc_link_search | Tells Cargo to pass |
warning | Tells Cargo to print the formatted |