pub struct Frame {
pub message: Message,
/* private fields */
}Expand description
Frame structure from websockets connection
Fields§
§message: MessageInner message
Implementations§
Source§impl Frame
impl Frame
Sourcepub const OP_CODE_CONTINUATION: u8 = 0x00
pub const OP_CODE_CONTINUATION: u8 = 0x00
Operation code for a continuation request
Sourcepub const OP_CODE_TEXT: u8 = 0x01
pub const OP_CODE_TEXT: u8 = 0x01
Operation code for a text message
Sourcepub const OP_CODE_BINARY: u8 = 0x02
pub const OP_CODE_BINARY: u8 = 0x02
Operation code for a binary message
Sourcepub const OP_CODE_CLOSE: u8 = 0x08
pub const OP_CODE_CLOSE: u8 = 0x08
Operation code for a close request message
Sourcepub const OP_CODE_PING: u8 = 0x09
pub const OP_CODE_PING: u8 = 0x09
Operation code for a ping message
Sourcepub const OP_CODE_PONG: u8 = 0x0A
pub const OP_CODE_PONG: u8 = 0x0A
Operation code for a pong message
Sourcepub fn op_code(&self) -> u8
pub fn op_code(&self) -> u8
Returns the OP CODE of the frame as a u8, where the last 4 bits contain the OP CODE
Sourcepub fn parse<A: AsRef<[u8]>>(content: A) -> Result<Frame, FrameParseError>
pub fn parse<A: AsRef<[u8]>>(content: A) -> Result<Frame, FrameParseError>
Attempts to parse a frame from a stream of bytes
Sourcepub fn ping<A: Into<Vec<u8>>>(payload: A) -> Frame
pub fn ping<A: Into<Vec<u8>>>(payload: A) -> Frame
Creates a ping message with the given application data
Sourcepub fn pong<A: Into<Vec<u8>>>(payload: A) -> Frame
pub fn pong<A: Into<Vec<u8>>>(payload: A) -> Frame
Creates a pong message with the given application data
Sourcepub fn get_message(&self) -> &Message
pub fn get_message(&self) -> &Message
Takes the frame and returns the contained message, if any
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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