Rust cargo cannot find postgres package
-
21-12-2019 - |
Pregunta
I have this in Cargo.toml
[dependencies.postgres]
git = "https://github.com/sfackler/rust-postgres.git"
This resulted in the following output, when running cargo build
:
$ cargo build -u
Updating git repository `https://github.com/sfackler/rust-postgres.git`
No package named `postgres` found (required by `hello-world`).
Location searched: https://github.com/sfackler/rust-postgres.git
Version required: *
What am I missing here?
Solución
Change [dependencies.postgres]
[dependencies.rust-postgres]
The reason for this is: Cargo.toml of that package is defines the package name as rust-postgres
, and this needs to match.
Note however, that it also defines the name of its lib
as just postgres
.
So you would do extern crate postgres;
(not extern crate rust-postgres;
)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow