是否有命令可以自动向 Cargo.toml 添加板条箱? [英] Is there a command to automatically add a crate to my Cargo.toml?
本文介绍了是否有命令可以自动向 Cargo.toml 添加板条箱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有类似的东西:cargo install stopwatch
但在文档中找不到它.
I expected there to be something like: cargo install stopwatch
but could not find it in the docs.
查找包版本并手动将包添加到.toml:
Finding the package version and manually adding the package to .toml:
[dependencies]
stopwatch="0.0.6"
感觉不够自动化.:)
推荐答案
不,Cargo 没有内置这样的东西.只有一个 cargo install
子命令用于安装包系统范围的二进制文件.
No, there is no such thing built in to Cargo. There is only a cargo install
subcommand which installs the binaries of a crate system-wide.
New third-party Cargo subcommands can be created, and cargo edit, does what you want.
这些cargo子命令可以通过cargo install
安装,在一个有趣的元圈中!
These cargo subcommands can then be installed by cargo install
, in a fun meta circle!
% cargo install cargo-edit
# Now `cargo add` is available
% cargo add mycrate
这篇关于是否有命令可以自动向 Cargo.toml 添加板条箱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文