这段代码有效:
let x = Some(2);
println!("{:?}", x);
但这并不会:
let x = Some(2);
println!("{}", x);
5 | println!("{}", x); | ^ std ::option::Option trait `std::fmt::Display` is not satisfied | = note: `std::option::Option` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string = note: required by `std::fmt::Display::fmt`
为什么?在这种情况下,:?
是什么意思?