pub struct Message { /* private fields */ }Expand description
The undecoded payload a channel broadcast or transmitted, exactly as it came off the
wire. Its shape is entirely up to the channel, so decode it into
the type you expect.
Implementations§
Source§impl Message
impl Message
Sourcepub fn from_json(json: impl Into<String>) -> Message
pub fn from_json(json: impl Into<String>) -> Message
Wraps JSON text without checking it. For protocol implementations, which have already parsed the frame around it.
Sourcepub fn decode<T: DeserializeOwned>(&self) -> Result<T, Error>
pub fn decode<T: DeserializeOwned>(&self) -> Result<T, Error>
Decodes the payload into the type the channel sends.
Trait Implementations§
impl Eq for Message
impl StructuralPartialEq for Message
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