pub enum Message {
Text(String),
Binary(Vec<u8>),
Ping(Vec<u8>),
Pong(Vec<u8>),
Close(Option<(u16, String)>),
Frame(FrameView),
}Expand description
WebSocket message type
Note: This enum holds owned data (String, Vec
Variants§
Text(String)
Text message
Binary(Vec<u8>)
Binary message
Ping(Vec<u8>)
Ping message
Pong(Vec<u8>)
Pong message
Close(Option<(u16, String)>)
Close message
Frame(FrameView)
Raw frame (for compatibility)
Implementations§
Source§impl Message
impl Message
Sourcepub fn to_frame_view(self) -> FrameView
pub fn to_frame_view(self) -> FrameView
Convert to yawc FrameView
Sourcepub fn from_frame_view(frame: FrameView) -> Self
pub fn from_frame_view(frame: FrameView) -> Self
Create from yawc FrameView
Source§impl Message
impl Message
Sourcepub const fn message_type(&self) -> MessageType
pub const fn message_type(&self) -> MessageType
Get the message type
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.