#macro #proc-macro #compilation

macro compile-time

Macros for getting compile time information

2 unstable releases

0.2.0 Jul 1, 2023
0.1.0 Jun 30, 2023

#765 in Procedural macros

Download history 2362/week @ 2026-01-26 4547/week @ 2026-02-02 4786/week @ 2026-02-09 4078/week @ 2026-02-16 3704/week @ 2026-02-23 3357/week @ 2026-03-02 3998/week @ 2026-03-09 3576/week @ 2026-03-16 2942/week @ 2026-03-23 3817/week @ 2026-03-30 3072/week @ 2026-04-06 3363/week @ 2026-04-13 2770/week @ 2026-04-20 2028/week @ 2026-04-27 3170/week @ 2026-05-04 2710/week @ 2026-05-11

11,024 downloads per month
Used in 22 crates (4 directly)

MIT/Apache

14KB
181 lines

compile-time

Crates.io Documentation

This crate provides macros for getting compile time information.

You can get the compile time either as time::Date, time::Time, time::OffsetDateTime, string, or UNIX timestamp.

You can get the Rust compiler version either as semver::Version or string, and the individual version parts as integer literals or strings, respectively.

Example

let compile_datetime = compile_time::datetime_str!();
let rustc_version = compile_time::rustc_version_str!();

println!("Compiled using Rust {rustc_version} on {compile_datetime}.");

Dependencies

~1MB
~22K SLoC