#[dependencies]Expand description
Embed and bind the build-time fingerprint.json in one expression.
Apply to an empty fn inside a function body; the function name becomes
the let binding in the expansion.
#[dependencies] // parse mode → BuildTimeFingerprintData (propagates ?)
#[dependencies(bytes)] // bytes mode → &'static [u8]Requires the dependency-graph-capture feature.
Embed and parse (or read the raw bytes of) the build-time
fingerprint.json fingerprint in one expression.
Apply to an empty fn; the function name becomes the let binding in
the expansion. Requires the dependency-graph-capture feature.
§Parse mode (default)
ⓘ
use toolkit_zero::dependency_graph::capture::{dependencies, BuildTimeFingerprintData};
fn show() -> Result<(), Box<dyn std::error::Error>> {
#[dependencies]
fn data() {}
// expands to:
// const __TOOLKIT_ZERO_BUILD_TIME_FINGERPRINT__: &str =
// include_str!(concat!(env!("OUT_DIR"), "/fingerprint.json"));
// let data = capture::parse(__TOOLKIT_ZERO_BUILD_TIME_FINGERPRINT__)?;
println!("{} v{}", data.package.name, data.package.version);
Ok(())
}§Bytes mode
ⓘ
fn raw_bytes() -> &'static [u8] {
#[dependencies(bytes)]
fn raw() {}
// expands to:
// const __TOOLKIT_ZERO_BUILD_TIME_FINGERPRINT__: &str =
// include_str!(concat!(env!("OUT_DIR"), "/fingerprint.json"));
// let raw: &'static [u8] = __TOOLKIT_ZERO_BUILD_TIME_FINGERPRINT__.as_bytes();
raw
}Full documentation is in the
crate-level #[dependencies] section.