#debugging #pi #print #condition

pi_debug_info

Whether to print is controlled by conditions

1 unstable release

0.1.0 Mar 1, 2022

#45 in #condition

Download history 4/week @ 2024-02-19 25/week @ 2024-02-26 8/week @ 2024-03-04 6/week @ 2024-03-11 10/week @ 2024-03-18 5/week @ 2024-03-25 28/week @ 2024-04-01

51 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

4KB

通过编译条件来控制打印


lib.rs:

提供两个宏,用于在输出内容到控制台上 debug_println!,与标准库中的println!具有相同的效果,但其受feature的控制,只有存在print这个feature时,才会输出 debug_print!,与标准库中的print!具有相同的效果,但其受feature的控制,只有存在print这个feature时,才会输出

##使用

Cargo.toml

 ...
 [features]
 default = ["print"] // 默认features中添加print时,源码中调用debug_println!或debug_print!,才能在控制台输出,否则不输出
 print=[]
 ...

example

debug_print!("打印一个数字:{}", 5);

Dependencies

~0–2MB
~40K SLoC