3
此代碼的工作:在Rust中,println中「{}」和「{:?}」有什麼區別!?
let x = Some(2);
println!("{:?}", x);
但這並不:
let x = Some(2);
println!("{}", x);
5 | println!("{}", x); | ^trait `std::option::Option: std::fmt::Display` 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`
爲什麼?在這種情況下,:?
是什麼?