Is there a command to automatically add a box to my Cargo.toml?

I expected that there would be something like: cargo install stopwatch , but cannot find it in the docs.

Search for a package version and add a package manually in .toml:

 [dependencies] stopwatch="0.0.6" 

Doesn't feel automated enough. :)

+5
source share
1 answer

No, there’s no such thing in Cargo. Starting with Cargo 0.6.0, there is a cargo install subcommand that will install the box into the system.

It looks like you could create a new cargo subcommand called cargo add-dependency , though! You can then publish it to make it available to others.

In fact, it looks like existing, edit the product , can do what you want.

These cargo subcommands can be installed on cargo install in a fun meta circle!

+6
source

Source: https://habr.com/ru/post/1232906/


All Articles