Skip to main content

Module build

Module build 

Source
Expand description

Build info: facts fixed when the application was compiled, answering “exactly which build is running?” in logs, crash reports, and health checks.

The application calls emit from its own build.rs (with sys-lib also in [build-dependencies]), and build_info! anywhere at run time:

// build.rs
fn main() {
    sys_lib::build::emit();
}
let build = sys_lib::build_info!();
println!("{build}");               // site 0.3.0 (9db9e36, release, built 2026-10-21T18:02:11Z)
println!("{}", build.public());    // site 0.3.0: safe for a public health endpoint

This module is the only code in sys-lib that runs another program, and it does so in the application’s build script, never at run time (D-004). It never fails the build: anything it cannot learn becomes unknown.

Structs§

BuildInfo
Facts fixed when the application was compiled. Get it with build_info!; every field is a &'static str in the binary, so it costs nothing at run time.
Emitter
What emit captures. See emitter.
PublicBuild
The name and version only: site 0.3.0. See BuildInfo::public.

Functions§

emit
Emits the build facts for build_info!. Call it from the application’s build.rs. Never fails and never panics.
emitter
A configurable emit.