Crates.io | etcdv3client |
lib.rs | etcdv3client |
version | 0.4.0 |
source | src |
created_at | 2019-11-22 10:23:01.481334 |
updated_at | 2024-07-11 13:40:19.786537 |
description | a simple etcdv3 client |
homepage | https://github.com/zzzdong/etcdv3client-rust |
repository | https://github.com/zzzdong/etcdv3client-rust |
max_upload_size | |
id | 183458 |
size | 327,632 |
[etcdv3client
] is a simple etcdv3 client in Rust-lang.
A basic example:
use etcdv3client::{EtcdClient, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
let endpoint = "http://localhost:2379";
let cred: None;
let mut client = EtcdClient::new(vec![endpoint], cred).await?;
let key = "/hello";
// use convenience api under EtcdClient.
match client.get(key).await {
Ok(v) => {
println!("got `{}` => {:?}", key, String::from_utf8_lossy(&v));
}
Err(err) => {
if err.is_key_not_found() {
eprintln!("can not find `{}`", key);
} else {
eprintln!("etcd get failed: `{:?}`", e);
}
}
}
Ok(())
}
More examples can be found in [examples
].
The current MSRV is 1.75.0.
This project is licensed under the MIT license.