2 unstable releases

0.2.0 Jul 1, 2023
0.1.0 Jun 30, 2023

#1414 in Procedural macros

Download history 128146/week @ 2024-10-10 136027/week @ 2024-10-17 167021/week @ 2024-10-24 132062/week @ 2024-10-31 156777/week @ 2024-11-07 134476/week @ 2024-11-14 110979/week @ 2024-11-21 50213/week @ 2024-11-28 118757/week @ 2024-12-05 135143/week @ 2024-12-12 49035/week @ 2024-12-19 25862/week @ 2024-12-26 116723/week @ 2025-01-02 144893/week @ 2025-01-09 101393/week @ 2025-01-16 51481/week @ 2025-01-23

415,124 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