17 releases

0.3.0 Apr 1, 2024
0.3.0-beta.4 Aug 8, 2023
0.3.0-beta.3 Nov 6, 2022
0.2.2 Jun 30, 2022
0.1.0-alpha.2 Nov 22, 2019

#201 in Asynchronous

Download history 10/week @ 2024-02-17 17/week @ 2024-02-24 8/week @ 2024-03-09 1/week @ 2024-03-16 155/week @ 2024-03-30 14/week @ 2024-04-06

175 downloads per month

MIT license

220KB
5K SLoC

etcdv3client-rust

Crates.io Documentation Rust Crates.io

Overview

etcdv3client is a simple etcdv3 client in Rust-lang.

Example

A basic example:

use etcdv3client::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let endpoint = "http://localhost:2379";
    let cred: Option<(String, String)> = None;
    let mut client = Client::new(vec![endpoint], cred).await?;

    let key = "/hello";
    // use convenience api under Client.
    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.

Support APIs

  • KV
  • Watch
  • Lease
  • Cluster
  • Maintenance
  • Auth

Supported Rust Versions

The current MSRV is 1.64.0.

License

This project is licensed under the MIT license.

Dependencies

~4.5–7MB
~118K SLoC