Skip to main content

AsyncSubscriber

Struct AsyncSubscriber 

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

Subscribed async TCP-RESP connection. Mirrors [kevy_client::Subscriber] for TCP backends.

Implementations§

Source§

impl AsyncSubscriber

Source

pub async fn connect(url: &str) -> Result<Self>

Open a fresh connection without subscribing yet. Call Self::subscribe / Self::psubscribe next.

Source

pub async fn open(url: &str, channels: &[&[u8]]) -> Result<Self>

Open and subscribe to one or more channels in one step.

Source

pub async fn subscribe(&mut self, channels: &[&[u8]]) -> Result<()>

SUBSCRIBE channel [channel ...]. Per-channel Subscribe acks arrive via Self::recv.

Source

pub async fn psubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>

PSUBSCRIBE pattern [pattern ...].

Source

pub async fn unsubscribe(&mut self, channels: &[&[u8]]) -> Result<()>

UNSUBSCRIBE [channel ...]. Empty list = unsubscribe all.

Source

pub async fn punsubscribe(&mut self, patterns: &[&[u8]]) -> Result<()>

PUNSUBSCRIBE [pattern ...]. Empty list = unsubscribe all.

Source

pub async fn recv(&mut self) -> Result<PubsubEvent>

Await the next pubsub frame. Connection close = UnexpectedEof.

Source

pub async fn recv_message(&mut self) -> Result<(Vec<u8>, Vec<u8>)>

Skip subscription-ack frames and return the next published Message / Pmessage. Returns (channel, payload); for pattern matches channel is the concrete publish channel (the matched pattern is discarded — use Self::recv if you need it).

Source

pub async fn hello3(&mut self) -> Result<PubsubEvent>

Negotiate RESP3 on this connection (HELLO 3). Must run BEFORE any subscribe — Redis spec requires HELLO be the first command. Returns a synthetic PubsubEvent::Subscribe marker (matching the blocking client) so callers can pattern-match a uniform type.

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.