2 unstable releases

0.2.0 Jul 1, 2023
0.1.0 Jun 30, 2023

#15 in #compiler-version

Download history 11/week @ 2024-01-08 104/week @ 2024-01-15 16/week @ 2024-01-22 10/week @ 2024-01-29 8/week @ 2024-02-05 36/week @ 2024-02-12 115/week @ 2024-02-19 281/week @ 2024-02-26 130/week @ 2024-03-04 92/week @ 2024-03-11 176/week @ 2024-03-18 352/week @ 2024-03-25 371/week @ 2024-04-01 143/week @ 2024-04-08 162/week @ 2024-04-15

1,093 downloads per month
Used in kalast

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