Skip to main content

AsyncRespCodec

Struct AsyncRespCodec 

Source
pub struct AsyncRespCodec<T> { /* private fields */ }
Expand description

Buffered RESP3 codec over an AsyncTransport.

Implementations§

Source§

impl<T: AsyncTransport> AsyncRespCodec<T>

Source

pub fn new(transport: T) -> Self

Wrap a transport. Matches the blocking client’s 8 KiB initial buffer capacity + 8 KiB read chunk — same memory footprint per connection as RespClient.

Source

pub fn into_inner(self) -> T

Get the underlying transport back (e.g. to swap it or close it explicitly).

Source

pub async fn request(&mut self, args: &[Vec<u8>]) -> Result<Reply>

Send one command (args = multibulk argv) and await exactly one reply. Direct async mirror of RespClient::request.

Source

pub async fn send(&mut self, args: &[Vec<u8>]) -> Result<()>

Encode + write a single command without waiting for a reply. Used by [crate::AsyncSubscriber]: SUBSCRIBE / PSUBSCRIBE etc. don’t return replies in the conventional sense — the server pushes ack frames that are drained later by read_reply.

Source

pub async fn read_reply(&mut self) -> Result<Reply>

Drain one parsed reply from the read buffer, reading more bytes from the transport as needed. Pipelining (T4.16) calls this N times after a single batched write.

Source

pub async fn pipeline(&mut self, batch: &[Vec<Vec<u8>>]) -> Result<Vec<Reply>>

Send N commands as one write batch (pipelining), then read N replies in declaration order. Single network round-trip if the transport supports it.

Auto Trait Implementations§

§

impl<T> Freeze for AsyncRespCodec<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for AsyncRespCodec<T>
where T: RefUnwindSafe,

§

impl<T> Send for AsyncRespCodec<T>
where T: Send,

§

impl<T> Sync for AsyncRespCodec<T>
where T: Sync,

§

impl<T> Unpin for AsyncRespCodec<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for AsyncRespCodec<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for AsyncRespCodec<T>
where T: UnwindSafe,

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.