首页 > 解决方案 > 无法使用 rusted_cypher 连接到 Neo4j

问题描述

我正在尝试将 Neo4j 与 Rust 一起使用。目前,没有官方驱动程序。我一直在尝试连接 rusted_cypher 板条箱,但无济于事。我在 Python 中广泛使用了 Neo4j,但我是 Rust 的新手。

这是最小的例子:

Cargo.toml

rusted_cypher = "1.1.0"

main.rs

use rusted_cypher::GraphClient;

fn main() {
    
    let graph = GraphClient::connect(
        "http://<username>:<password>@localhost:7474/<database_name>/data").unwrap();

}

这将返回:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Serde(Error("EOF while parsing a value", line: 1, column: 0))', src/main.rs:6:53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

当我尝试删除数据库名称时,我得到:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Serde(Error("missing field `extensions`", line: 0, column: 0))', src/main.rs:6:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

标签: rustneo4jserde

解决方案


似乎生锈的密码不再适用于更改的数据库 URL,现在http(s)//:host:7474/db/<database>/tx

但是我发现这两个驱动程序看起来更有前途,最近更新并使用了螺栓:

https://github.com/lucis-fluxum/bolt-rs

https://github.com/yehohanan7/neo4rs

文档:https ://docs.rs/neo4rs/0.5.8/neo4rs/


推荐阅读