Expand description
ember-client: async Rust client for ember.
Connects to an ember server over TCP (or TLS) and exposes a typed async
API covering all common commands. Raw RESP3 frames are available via
Client::send when you need something not covered by the typed methods.
§Quick start
use ember_client::Client;
#[tokio::main]
async fn main() -> Result<(), ember_client::ClientError> {
let mut client = Client::connect("127.0.0.1", 6379).await?;
client.set("greeting", "hello").await?;
let value = client.get("greeting").await?;
println!("{value:?}"); // Some(b"hello")
Ok(())
}§Pipelining
Send multiple commands in one round-trip using Pipeline:
use ember_client::{Client, Pipeline};
#[tokio::main]
async fn main() -> Result<(), ember_client::ClientError> {
let mut client = Client::connect("127.0.0.1", 6379).await?;
let frames = client.execute_pipeline(
Pipeline::new()
.set("a", "1")
.set("b", "2")
.get("a")
.get("b"),
).await?;
println!("{} responses", frames.len());
Ok(())
}Re-exports§
pub use subscriber::Message;pub use subscriber::Subscriber;pub use tls::TlsClientConfig;
Modules§
- subscriber
- Pub/sub subscriber mode.
- tls
- TLS configuration and connection helpers for ember-client.
Structs§
- Client
- An async client connected to a single ember server.
- Pipeline
- A batch of commands to be sent in a single network round-trip.
- Scan
Page - A page of keys returned by
Client::scan. - Slowlog
Entry - A single entry from
Client::slowlog_get.
Enums§
- Client
Error - Errors that can occur during client operations.
- Frame
- A single RESP3 protocol frame.