pub enum PubsubFrame {
Subscribe {
channel: Vec<u8>,
count: usize,
},
Psubscribe {
pattern: Vec<u8>,
count: usize,
},
Unsubscribe {
channel: Option<Vec<u8>>,
count: usize,
},
Punsubscribe {
pattern: Option<Vec<u8>>,
count: usize,
},
Message {
channel: Vec<u8>,
payload: Vec<u8>,
},
Pmessage {
pattern: Vec<u8>,
channel: Vec<u8>,
payload: Vec<u8>,
},
}Expand description
One pub/sub event delivered to a Subscription.
Variants§
Subscribe
Ack: SUBSCRIBE succeeded on channel.
Fields
Psubscribe
Ack: PSUBSCRIBE succeeded on pattern.
Fields
Unsubscribe
Ack: UNSUBSCRIBE removed channel (or “all”, when None).
Fields
Punsubscribe
Ack: PUNSUBSCRIBE removed pattern (or “all”, when None).
Fields
Message
A PUBLISH reached a channel this subscription holds directly.
Pmessage
A PUBLISH reached a channel matching one of this subscription’s
patterns.
Implementations§
Source§impl PubsubFrame
impl PubsubFrame
Sourcepub fn into_payload(self) -> Option<Vec<u8>>
pub fn into_payload(self) -> Option<Vec<u8>>
The raw message payload, moved out of the frame.
Some(payload) for the two delivery frames (Message
and Pmessage); None for every control/ack frame
(subscribe / unsubscribe / …), which carries no payload. Consuming
self lets a scalar drain hand a push subscriber just the bytes with
no extra copy — the pub/sub analog of the KV scalar door. The channel
and the message-vs-pmessage distinction are dropped; a caller that
needs either keeps matching on the frame.
Trait Implementations§
Source§impl Clone for PubsubFrame
impl Clone for PubsubFrame
Source§fn clone(&self) -> PubsubFrame
fn clone(&self) -> PubsubFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more