2 unstable releases

0.2.0 Jul 1, 2023
0.1.0 Jun 30, 2023

#1526 in Procedural macros

Download history 122913/week @ 2024-11-17 72408/week @ 2024-11-24 61639/week @ 2024-12-01 156195/week @ 2024-12-08 112849/week @ 2024-12-15 22234/week @ 2024-12-22 60801/week @ 2024-12-29 124570/week @ 2025-01-05 138643/week @ 2025-01-12 94650/week @ 2025-01-19 11601/week @ 2025-01-26 2668/week @ 2025-02-02 1507/week @ 2025-02-09 974/week @ 2025-02-16 1289/week @ 2025-02-23 1136/week @ 2025-03-02

4,951 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
~18K SLoC