postgresql - Rust cargo 找不到 postgres 包

标签 postgresql rust rust-cargo rust-crates

我在 Cargo.toml 中有这个

[dependencies.postgres]

git = "https://github.com/sfackler/rust-postgres.git"

运行 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: *

我在这里错过了什么?

最佳答案

更改[dependencies.postgres] [dependencies.rust-postgres]

原因是:Cargo.toml该包的定义包名称为 rust-postgres,这需要匹配。

但是请注意,它还将其 lib 的名称定义为 postgres。 所以你会做 extern crate postgres;(不是 extern crate rust-postgres;)

关于postgresql - Rust cargo 找不到 postgres 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25052767/

相关文章:

postgresql - Docker-compose无法连接到Docker postgres容器

error-handling - 用 monad 解开匹配语句

parsing - .next()方法在 `std::string::String`中找不到

rust - 如何访问通过 `cargo install` 安装的 Rust/Cargo 项目中包含的 Assets ?

sql - [在 Postgres 中] 锁定的行仍然可以读取吗?

postgresql - 使用 "SELECT DISTINCT"时如何保留额外的 key ?

MySQL 与 PostgreSQL 与 SSRS

string - 如何 append 到 Rust 哈希表中的字符串值?

rust - Cargo 中的全局特征门

rust - 如何使用Cargo下载 crate 的文档?