pub struct RespClient { /* private fields */ }Expand description
A blocking RESP2 connection over TcpStream.
Holds the stream plus an incremental read buffer so multi-segment replies
reassemble across read calls. Not Sync; one client per thread.
Implementations§
Source§impl RespClient
impl RespClient
Sourcepub fn connect(host: &str, port: u16) -> Result<Self>
pub fn connect(host: &str, port: u16) -> Result<Self>
Connect to host:port, enabling TCP_NODELAY (best-effort).
Sourcepub fn request(&mut self, args: &[Vec<u8>]) -> Result<Reply>
pub fn request(&mut self, args: &[Vec<u8>]) -> Result<Reply>
Send one command (args is RESP-encoded as a multibulk array) and
block until exactly one reply is parsed. Returns the parsed Reply.
Sourcepub fn from_url(url: &str) -> Result<Self>
pub fn from_url(url: &str) -> Result<Self>
Connect from a URL string.
Accepted schemes (all wire-protocol identical — RESP2 over TCP):
kevy://host[:port][/db]— kevy-native alias ofredis://.redis://host[:port][/db]— standard Redis URL (every official client lib speaks this).tcp://host[:port]— plain TCP with no leading SELECT round-trip.
Auth and TLS schemes (redis://user:pass@…, rediss://) are NOT
supported — kevy itself ships without AUTH/TLS. Including a userinfo
component or using rediss:// returns io::ErrorKind::Unsupported.
If a /db path segment is present, an explicit SELECT <db> is
issued before returning the client. For non-zero indices kevy will
reply with its “only supports DB 0” error and from_url propagates
that as io::ErrorKind::Other.