Дми*_*мар 6 rust
我的代码:
extern crate time; fn main() { println!("{}", time::get_time()); }
我的错误是:
Error 'the trait bound time::Timespec: std::fmt::Display is not satisfied
mal*_*rbo 19
println!是一个做格式化输出的宏.{}用于打印实现Display特征的值.错误是说Timespec没有实现Display特性,所以它不能用于{}.
println!
{}
Display
Timespec
你可以用{:?}而不是{}.{:?}用于打印实现Debug特征并Timespec实现特征的值.
{:?}
Debug
考虑阅读fmt模块文档,它会详细解释.
fmt
归档时间:
9 年,5 月 前
查看次数:
4752 次
最近记录: