Skip to main content

TransactionReplies

Struct TransactionReplies 

Source
pub struct TransactionReplies { /* private fields */ }
Expand description

Typed cursor over the per-queued-command replies of a successful EXEC. Produced by Transaction::exec_typed / Transaction::exec_watched_typed. Each next_* consumes one reply; if the variant doesn’t match the extractor, an io::ErrorKind::InvalidData is returned and the cursor advances regardless (so a downstream expect_empty still works correctly).

Implementations§

Source§

impl TransactionReplies

Source

pub fn remaining(&self) -> usize

Number of replies still un-consumed.

Source

pub fn expect_empty(&mut self) -> Result<()>

Error out if the cursor still has replies — useful at the end of a typed read sequence to assert the queued-command count matched.

Source

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

Pop the next reply as a raw Reply. Escape hatch for verbs the typed extractors don’t cover.

Source

pub fn next_ok(&mut self) -> Result<()>

Expect Reply::Simple(b"OK")SET / MSET ack.

Source

pub fn next_ok_or_nil(&mut self) -> Result<bool>

Expect Reply::Simple(b"OK") OR Reply::NilSET key v NX/XX returns Nil when the condition is not met.

Source

pub fn next_int(&mut self) -> Result<i64>

Expect Reply::IntINCR / DEL / EXISTS / INCRBY.

Source

pub fn next_bulk(&mut self) -> Result<Option<Vec<u8>>>

Expect Reply::Bulk (or NilNone) — GET.

Source

pub fn next_array_of_bulks(&mut self) -> Result<Vec<Option<Vec<u8>>>>

Expect Reply::Array of Bulk/Nil entries — MGET. Returns Vec<Option<Vec<u8>>> in request order.

Source

pub fn next_simple(&mut self) -> Result<Vec<u8>>

Expect Reply::Simple (any payload) — for verbs whose ack isn’t OK (e.g. PING+PONG).

Trait Implementations§

Source§

impl Debug for TransactionReplies

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.