Cargo packages install without .toml


#1

I want to install cargo packages like conda, pip and vcpkg.


#2

What do you mean by installing? Application crates can be installed with cargo install, library crates are automatically cached whenever used, so they are downloaded only once, so it can be considered kind-of “automatic installation”.


#3

Cargo can’t install non-cargo packages.

If other package repository has a package you want, you will have to wrap it in a Cargo package. Usually these are called “sys” crates. For example there’s vcpkg Cargo crate that helps Cargo build scripts find installed vcpkg packages.


#4

pip, conda, and vcpkg are all package managers. I think he meant for cargo to work like they do, i.e.

cargo install serde

and then you would be able to use serde in any crate, without putting it in Cargo.toml.


Trying to put functionality like that into cargo is like trying to put a round peg into a… fax machine. Rust’s compilation model at its very core supports multiple versions of a dependency being included in a project, which seems to break every possible notion of what it means to have a global installation. I’m not sure how linux distro maintainers have been dealing with this, but I can’t imagine it has been fun.