pub enum RelayFrame {
Subscribe {
topic: String,
},
Unsubscribe {
topic: String,
},
Publish {
topic: String,
data: Vec<u8>,
},
SubAck {
topic: String,
},
Event {
topic: String,
data: Vec<u8>,
},
}Expand description
A frame on the relay WebSocket. Client→relay: Subscribe/Unsubscribe/
Publish. Relay→client: SubAck/Event.
Variants§
Subscribe
Client → relay: start receiving Events for topic.
Unsubscribe
Client → relay: stop receiving topic.
Publish
Client → relay: deliver data to every subscriber of topic.
SubAck
Relay → client: acknowledges a Subscribe is registered (so a publish
that races a subscribe cannot be missed — the client awaits this).
Event
Relay → client: a published message on a topic the client subscribes to.
Implementations§
Source§impl RelayFrame
impl RelayFrame
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize to the bytes that cross the WebSocket (a binary message).
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<RelayFrame>
pub fn from_bytes(bytes: &[u8]) -> Option<RelayFrame>
Deserialize a frame from WebSocket bytes; None on a malformed frame.
Trait Implementations§
Source§impl Clone for RelayFrame
impl Clone for RelayFrame
Source§fn clone(&self) -> RelayFrame
fn clone(&self) -> RelayFrame
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RelayFrame
impl Debug for RelayFrame
Source§impl<'de> Deserialize<'de> for RelayFrame
impl<'de> Deserialize<'de> for RelayFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RelayFrame
impl PartialEq for RelayFrame
Source§fn eq(&self, other: &RelayFrame) -> bool
fn eq(&self, other: &RelayFrame) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RelayFrame
impl Serialize for RelayFrame
impl Eq for RelayFrame
impl StructuralPartialEq for RelayFrame
Auto Trait Implementations§
impl Freeze for RelayFrame
impl RefUnwindSafe for RelayFrame
impl Send for RelayFrame
impl Sync for RelayFrame
impl Unpin for RelayFrame
impl UnsafeUnpin for RelayFrame
impl UnwindSafe for RelayFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.