【发布时间】:2020-08-22 03:25:54
【问题描述】:
我尝试构建single_mem_node example,但作为一个独立示例并将raft-rs crate 用作库。
但不幸的是,我在使用 cargo build 构建时遇到此构建错误
error[E0599]: no method named `is_empty` found for reference `&raft_proto::protos::eraftpb::Snapshot` in the current scope
--> src/main.rs:123:26
|
123 | if !ready.snapshot().is_empty() {
| ^^^^^^^^ method not found in `&raft_proto::protos::eraftpb::Snapshot`
我已经在 Cargo.toml 中声明了这些依赖项
[dependencies]
protobuf = { version = "2", features = ["with-bytes"] }
raft = "0.6.0-alpha"
slog = "2.5.2"
slog-term = "2.6.0"
slog-async = "2.5.0"
raft-rs crate 的使用说明如下:
您可以将 raft 与 rust-protobuf 或 Prost 一起使用来编码/解码 gRPC 消息。我们默认使用 rust-protobuf。要使用 Prost,请使用 prost-codec 功能构建(或依赖)Raft,而不使用默认功能。
看起来我确实想念protobuf 周围的一些东西...但是什么?以及如何得知?
【问题讨论】:
标签: rust protocol-buffers rust-cargo