pub struct Message { /* private fields */ }Implementations§
Source§impl Message
impl Message
Sourcepub fn new(seq: u32, topic: Bytes, payload: Bytes, compression_type: u8) -> Self
pub fn new(seq: u32, topic: Bytes, payload: Bytes, compression_type: u8) -> Self
Creates a new message with the given sequence number, topic, and payload. If the payload is empty, the server will interpret this as a subscription toggle for the given topic. The timestamp is set to the current UNIX timestamp in microseconds.
§Panics
Panics if the topic is larger than 65535 bytes.
Sourcepub fn new_sub(topic: Bytes) -> Self
pub fn new_sub(topic: Bytes) -> Self
Creates a new subscribe message for the given topic. The topic is prefixed with
MSG.SUB..
Sourcepub fn new_unsub(topic: Bytes) -> Self
pub fn new_unsub(topic: Bytes) -> Self
Creates a new unsubscribe message for the given topic. The topic is prefixed with
MSG.UNSUB..
pub fn seq(&self) -> u32
pub fn payload_size(&self) -> u32
pub fn timestamp(&self) -> u64
pub fn size(&self) -> usize
pub fn payload(&self) -> &Bytes
pub fn into_payload(self) -> Bytes
pub fn into_parts(self) -> (Bytes, Bytes)
pub fn compression_type(&self) -> u8
pub fn topic(&self) -> &Bytes
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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