简体   繁体   中英

How can I find the latest stable version of a crate using cargo?

I want to know the latest actix-web version, so I executed cargo search actix-web . The result is actix-web = "4.0.0-beta.1" , showing the beta version number.

I want to know the latest stable version number; how do I get it?

cargo show --json $1 | python -m json.tool | jq ".versions[].num"

Usually, I only care to know about the version number of a crate when I'm going to add the crate to my Cargo.toml. In those cases, I use two extra Cargo subcommands from the cargo-edit project :

  • cargo add — adds the current stable version of a crate to Cargo.toml . Options exist for allowing prerelease versions or marking it as a build / dev dependency.
  • cargo upgrade — updates the version of a crate already in Cargo.toml . Similar to cargo update , but also changes Cargo.toml in addition to Cargo.lock .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM