我怎么能用铁 rust 印一条路?
为了打印当前工作目录,我try 了以下操作:
use std::os;
fn main() {
let p = os::getcwd();
println!("{}", p);
}
但rustc
返回时出现以下错误:
[wei2912@localhost rust-basics]$ rustc ls.rs
ls.rs:5:17: 5:18 error: failed to find an implementation of trait core::fmt::Show for std::path::posix::Path
ls.rs:5 println!("{}", p);
^
note: in expansion of format_args!
<std macros>:2:23: 2:77 note: expansion site
<std macros>:1:1: 3:2 note: in expansion of println!
ls.rs:5:2: 5:20 note: expansion site