My code:
extern crate time;
fn main() {
println!("{}", time::get_time());
}
My error is:
Error 'the trait bound time::Timespec: std::fmt::Display is not satisfied
println!
is a macro to do formatted output. {}
is used to print a value that implements the Display
trait. The error is saying that Timespec
does not implement the Display
trait, so it cannot be used with {}
.
You can use {:?}
instead of {}
. {:?}
is used to print a value that implements Debug
trait and Timespec
implements it.
Consider reading the fmt
module documentation, it explain this in detail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With