4 个版本

0.1.3 2023年5月1日
0.1.2 2022年8月5日
0.1.1 2021年6月24日
0.1.0 2021年5月31日

181构建工具

Download history · Rust 包仓库 12311/week @ 2024-03-14 · Rust 包仓库 11114/week @ 2024-03-21 · Rust 包仓库 11758/week @ 2024-03-28 · Rust 包仓库 11505/week @ 2024-04-04 · Rust 包仓库 11079/week @ 2024-04-11 · Rust 包仓库 12633/week @ 2024-04-18 · Rust 包仓库 12184/week @ 2024-04-25 · Rust 包仓库 12030/week @ 2024-05-02 · Rust 包仓库 11890/week @ 2024-05-09 · Rust 包仓库 11409/week @ 2024-05-16 · Rust 包仓库 11230/week @ 2024-05-23 · Rust 包仓库 12361/week @ 2024-05-30 · Rust 包仓库 12412/week @ 2024-06-06 · Rust 包仓库 12817/week @ 2024-06-13 · Rust 包仓库 12597/week @ 2024-06-20 · Rust 包仓库 9923/week @ 2024-06-27 · Rust 包仓库

49,765 每月下载量
58 个crate(10个直接) 中使用

MIT 许可证

7KB

build-time

生成构建时间戳字符串字面量的简单过程宏。

基于Jasen Borisov的build_timestamp crate。

提供了两个类似函数的过程:build_time_utcbuild_time_local

它们接受可选的 strftime 日期和时间格式字符串作为输入,并返回一个字符串字面量。如果输入为空,它们将返回一个按照 RFC 3339 日期和时间格式 的字符串字面量,例如:"2021-05-29T06:55:50.418437046+00:00"

需要Rust 1.45+,因为这些宏在表达式位置中使用。

使用方法

use build_time::{build_time_utc, build_time_local};

// Returns the UTC build timestamp in RFC3339 date and time format.
let utc_build_time = build_time_utc!();

// Returns the local build timestamp in the specified format.
let local_build_time = build_time_local!("%Y-%m-%dT%H:%M:%S%.f%:z");

lib.rs:

build-time

生成构建时间戳字符串字面量的简单过程宏。

基于Jasen Borisov的build_timestamp crate。

提供了两个类似函数的过程:build_time_utcbuild_time_local

它们接受可选的 strftime 日期和时间格式字符串作为输入,并返回一个字符串字面量。如果输入为空,它们将返回一个按照 RFC 3339 日期和时间格式 的字符串字面量,例如:"2021-05-29T06:55:50.418437046+00:00"

需要Rust 1.45+,因为这些宏在表达式位置中使用。

使用方法

use build_time::{build_time_utc, build_time_local};

// Returns the UTC build timestamp in RFC3339 date and time format.
let utc_build_time = build_time_utc!();

// Returns the local build timestamp in the specified format.
let local_build_time = build_time_local!("%Y-%m-%dT%H:%M:%S%.f%:z");

依赖项

~1.4–7MB
~42K SLoC