#字符串插值 #内联 # #详细 # #标准 #ifmt

ifmt-impl

ifmt crate的实现细节

7 个版本

0.3.3 2021年1月6日
0.3.2 2020年9月9日
0.3.0 2020年1月13日
0.2.0 2019年6月6日
0.1.3 2019年5月26日

#12 in #字符串插值

Download history 107/week @ 2024-04-04 123/week @ 2024-04-11 125/week @ 2024-04-18 107/week @ 2024-04-25 121/week @ 2024-05-02 76/week @ 2024-05-09 119/week @ 2024-05-16 168/week @ 2024-05-23 110/week @ 2024-05-30 69/week @ 2024-06-06 117/week @ 2024-06-13 157/week @ 2024-06-20 71/week @ 2024-06-27 143/week @ 2024-07-04 75/week @ 2024-07-11 41/week @ 2024-07-18

每月下载量372
8 个crate中(通过 ifmt)使用

MIT/Apache

17KB
335

ifmt

一个小crate,可以将内联字符串插值带到Rust的标准格式化宏中。

入门指南

要在项目中使用ifmt,请将以下内容添加到您的Cargo.toml中:

[dependencies]
ifmt = "0.3.3"

...

示例

let four = 4;
iprintln!("four plus four is: " four + 4);
// four plus four is: 8
iprintln!("here's a hex number: 0x" 0xb0bi64 * 1321517i64 ;x);
// here's a hex number: 0xdeadbeef
iprintln!("here's a debugging value: " Some(four);?);
// here's a debugging value: Some(4)

支持的宏

format!      -> iformat!
print!       -> iprint!
println!     -> iprintln!
eprint!      -> ieprint!
eprintln!    -> ieprintln!
write!       -> iwrite!
writeln!     -> iwriteln!
panic!       -> ipanic!
format_args! -> iformat_args!

许可证

此项目根据您的选择受MIT许可证或Apache 2.0许可证的许可。

依赖项

~3–4.5MB
~87K SLoC