2个版本
0.1.1 | 2022年4月11日 |
---|---|
0.1.0 | 2022年4月11日 |
#123 在 #derive-debug
36 每月下载次数
用于 reim
4KB
disp
为实现了Debug的类型派生Display
示例
mod hello {
use std::fmt::Display;
#[derive(Debug, disp::Display)]
pub struct Hello {}
}
fn main() {
let hello = hello::Hello {};
println!("Debug: {hello:?}, world!");
println!("Display: {hello}, world!");
}
输出
Debug: Hello, world!
Display: Hello, world!
lib.rs
:
disp
为实现了Debug的类型派生Display
示例
mod hello {
use std::fmt::Display;
#[derive(Debug, disp::Display)]
pub struct Hello {}
}
fn main() {
let hello = hello::Hello {};
println!("Debug: {hello:?}, world!");
println!("Display: {hello}, world!");
}
输出
Debug: Hello, world!
Display: Hello, world!
依赖项
~1.5MB
~35K SLoC