Skip to main content

RespClient

Struct RespClient 

Source
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

Source

pub fn connect(host: &str, port: u16) -> Result<Self>

Connect to host:port, enabling TCP_NODELAY (best-effort).

Source

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.

Source

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 of redis://.
  • 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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.