Dav*_*ela 3 linux rust rust-cargo
我创建了一个项目:cargo new projectname --bin.我如何更改projectname为其他名称?
cargo helpcargo --listman cargo在元数据文件(Cargo.toml,Cargo.lock,...)中,有"名称"和"路径".我想我可以手动更改它们,但我不知道这是否会破坏任何东西.
最好的方法是什么?
我认为你应该手动更改它.真的不是那么难.
我运行这段代码:
$ cargo new smurf --bin
Created binary (application) `smurf` project
$ cd smurf/
smurf$ cargo build
....
smurf$ grep -rl smurf .
./target/debug/smurf.d
./target/debug/smurf
./target/debug/.fingerprint/smurf-35f069edf7faaa12/bin-smurf-35f069edf7faaa12.json
./target/debug/.fingerprint/smurf-35f069edf7faaa12/dep-bin-smurf-35f069edf7faaa12
./target/debug/deps/smurf-35f069edf7faaa12
./Cargo.lock
./Cargo.toml
Run Code Online (Sandbox Code Playgroud)
从所有这些文件中,target可以删除整个文件.该.lock文件也可以删除.而且Cargo.toml......你可以编辑它.
我尝试只更改Cargo.toml所有正常工作.但是你最终得到了无用的文件,target所以我建议你删除它们.
小智 5
在 Linux 下,这是相当简单的:
pi@raspberrypi:~/workspace/rust/hello_world $ cd ..mv hello_world/ hello_rust/以重命名该文件夹。pi@raspberrypi:~/workspace/rust $ cd hello_rust/pi@raspberrypi:~/workspace/rust/hello_rust $ geany Cargo.tomlname = "hello_world"到name = "hello_rust"希望这可以帮助将来的人
| 归档时间: |
|
| 查看次数: |
2106 次 |
| 最近记录: |