2 unstable releases

0.2.0 Jul 1, 2023
0.1.0 Jun 30, 2023

#331 in Procedural macros

Download history 72274/week @ 2024-07-23 72111/week @ 2024-07-30 72670/week @ 2024-08-06 96923/week @ 2024-08-13 101418/week @ 2024-08-20 82923/week @ 2024-08-27 102164/week @ 2024-09-03 113536/week @ 2024-09-10 101777/week @ 2024-09-17 124989/week @ 2024-09-24 118129/week @ 2024-10-01 142750/week @ 2024-10-08 132192/week @ 2024-10-15 155612/week @ 2024-10-22 143366/week @ 2024-10-29 126670/week @ 2024-11-05

575,289 downloads per month
Used in 4 crates (2 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}.");

lib.rs:

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
~17K SLoC