Rust 程序设计语言 简体中文版 1.85.0这行代码现在打印了存储用户输入的字符串。{} 这对大括号是一个占位符:把 {} 想象成小蟹 钳,可以夹住合适的值。当打印变量的值时,变量名可以写进大括号中。当打印表达式的执行 结果时,格式化字符串(format string)中大括号中留空,格式化字符串后跟逗号分隔的需要 打印的表达式列表,其顺序与每一个空大括号占位符的顺序一致。在一个 println! 调用中打 印变量和表达式的值看起来像这样: let ^^^^ value borrowed here after move | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro- 简体中文版 = help: the trait `std::fmt::Display` is not implemented for `Rectangle` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty- print) instead 让我们来试试!现在 println! 宏调用看起来像0 码力 | 562 页 | 3.23 MB | 22 天前3
共 1 条
- 1













