Is there a cargo
command that does this: "I have this package named X, I want to install the dependency, add it to Cargo.toml, and I don't care about the version, just add the latest stable one."
I dont want to manually add dependencies in Cargo.toml and have to look up their versions every single time.
In Node.js / npm when I want to install a package and I don't care about its version, I use the command npm install <package>
. This results in the package dependency being installed in the node_modules/
directory and the package + version pair being added in the package.json
file under the dependencies
key. Before npm@5.0.0, you had to use the --save
option, to automatically add the dependency to package.json
, on top of already copying to node_modules/
from the registry.
Rust's equivalent to npm
is cargo
, and the package.json
equivalent is Cargo.toml
.
Here's what I've tried:
$ cargo install actix-files
Updating crates.io index
error: specified package `actix-files v0.2.1` has no binaries
Well obviously actix-file
has no binaries, because it's a library. And if we have the version already, why not just add actix-files = "0.2.1"
to my Cargo.toml
file? The documentation mentions nothing like this.