built provides a crate with information from the time it was built.

Crates.io Version Docs Build status Build Status

built is used as a build-time dependency to collect various information about the build environment and serialize it into the final crate. The information collected by built include:


```rust,ignore // In build.rs

fn main() { built::writebuiltfile().expect("Failed to acquire build-time information") } ```

```rust,ignore // In lib.rs or main.rs

pub mod builtinfo { include!(concat!(env!("OUTDIR"), "/built.rs")); }

println!( "This is version {}{}, built for {} by {}.", builtinfo::PKGVERSION, builtinfo::GITVERSION.maporelse(|| "".toowned(), |v| format!(" (git {})", v)), builtinfo::TARGET, builtinfo::RUSTCVERSION );

match builtinfo::CIPLATFORM { None => print!("It seems I've not been built on a continuous integration platform,"), Some(ci) => print!("I've been built on CI-platform {},", ci), }

if built::util::detectci().issome() { println!(" but I'm currently executing on one!"); } else { println!(" and I'm currently not executing on one!"); } ```

This is version 0.1.0 (git 0.1-62-gcfdfb93), built for x86_64-unknown-linux-gnu by rustc 1.40.0 (73528e339 2019-12-16). It seems I've not been built on a continuous integration platform, and I'm currently not executing on one!