Skip to main content

Crate kevy_client_async

Crate kevy_client_async 

Source
Expand description

kevy-client-async — async client for kevy, runtime-agnostic core with feature-gated transports for tokio, smol, and async-std.

§Status

Phase-4 first cut (T4.x). Surface is intentionally a near-1:1 mirror of the blocking [kevy_client::Connection], plus the pipeline-first sugar locked by RFC 2026-06-18-v3-cluster Q4 part b. See docs/async.md (added T4.26) for the full guide.

§Runtime selection

Exactly one of the following Cargo features must be enabled:

featuretransport
tokiotokio::net::TcpStream (T4.5)
smolsmol::net::TcpStream (T4.6)
async-stdasync_std::net::TcpStream (T4.7)

default = ["tokio"] is a dev convenience so cargo test --workspace builds without flags; lib consumers should set default-features = false and pick their runtime explicitly so the wrong one is never silently inherited. Enabling zero or more than one triggers a compile_error! from this crate (T4.8).

§Dep-rule exemption

This crate is the sole carved exemption from the project’s 0-crates.io-dep rule. Rationale: the Rust async ecosystem has no std-only viable substrate. The exemption is per-crate and per-dep: kevy-client-async may dep tokio / smol / async-std (and only those three) with default-features = false + minimum-surface features and an inline # EXEMPTION Cargo.toml comment. See RFC F5 and memory feedback-pure-rust-no-c-principle.md.

§Error compatibility

Every async method returns std::io::Result<T> with the same ErrorKind variants the blocking kevy_client surface produces. This is contract, not coincidence — it lets caller code carry over without changing match arms.

sourceErrorKind
RESP -ERR … replyOther
unexpected reply variantOther
malformed RESP frameInvalidData
server closed connection mid-readUnexpectedEof
unknown URL scheme / bad port / etc.InvalidInput
TLS / AUTH / embed URL schemeUnsupported
underlying socket I/O(native kind)

Wider error context (the RESP error string, the unexpected variant name) is carried in the io::Error’s message — fetch with .to_string() / .into_inner().

Re-exports§

pub use codec::AsyncRespCodec;
pub use conn::AsyncConnection;
pub use transport::AsyncRead;
pub use transport::AsyncTransport;
pub use transport::AsyncWrite;
pub use transport::read;
pub use transport::write_all;

Modules§

cluster
Async cluster-aware client: one connection per shard, CRC16 routing per key. Mirror of kevy_client::ClusterClient.
cmd_hash
Async mirror of hash commands on kevy_client::Connection.
cmd_list
Async mirror of list commands on kevy_client::Connection.
cmd_set
Async mirror of set commands on kevy_client::Connection.
cmd_string
Async mirror of the string + generic key commands on [kevy_client::Connection]. Each method here is a 1:1 translation of the corresponding blocking method: same name, same arguments, same return type modulo .await.
cmd_zset
Async mirror of sorted-set commands on kevy_client::Connection.
codec
Async RESP3 codec — state machine mirroring the blocking [kevy_resp_client::RespClient] but with async IO.
conn
Async equivalent of [kevy_client::Connection] — TCP-only.
pipeline
Pipeline-first sugar — RFC Q4 part b. Where async actually pays off: one TCP round-trip per batch instead of per command.
pubsub
PubsubEvent enum — mirror of the type in kevy_client::subscribe::PubsubEvent. Lives here so the async subscriber doesn’t have to dep on the blocking client crate.
rt_tokio
Tokio runtime adapter — implements crate::transport::AsyncRead / crate::transport::AsyncWrite on top of tokio::net::TcpStream.
subscriber
Async mirror of kevy_client::Subscriber — TCP-only.
transport
Async IO traits — runtime-agnostic core.
url
URL parsing for the async client.