Crates.io | build_timestamp |
lib.rs | build_timestamp |
version | 0.1.0 |
source | src |
created_at | 2018-09-08 08:03:10.95923 |
updated_at | 2018-09-08 08:03:10.95923 |
description | Simple proc-macro to generate a build timestamp string as a const |
homepage | |
repository | https://gitlab.com/jamadazi/build_timestamp |
max_upload_size | |
id | 83582 |
size | 15,179 |
build_timestamp
is a simple proc-macro for Rust to generate a const
string
with a build timestamp (in UTC), formatted with strftime
syntax.
Note: using this crate makes your build non-deterministic!
Note: using this crate requires nightly Rust
// Rust2018 macro import
use build_timestamp::build_time;
// generates a `const BUILD_TIME: &str`
build_time!("%A %Y-%m-%d / %H:%M:%S");
fn main() {
println!("This is {}, built on: {}",
env!("CARGO_PKG_NAME"), BUILD_TIME);
}
Running this example will print something that looks like:
This is my_crate, built on: Saturday 2018-09-08 / 11:35:43
Features that I'd like this crate to support in the future:
unwrap()
to panic)const
If you would like to implement any of this, I welcome patches.