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 = 0u8
pub const OP_CODE_CONTINUATION: u8 = 0u8
Operation code for a continuation request
Sourcepub const OP_CODE_TEXT: u8 = 1u8
pub const OP_CODE_TEXT: u8 = 1u8
Operation code for a text message
Sourcepub const OP_CODE_BINARY: u8 = 2u8
pub const OP_CODE_BINARY: u8 = 2u8
Operation code for a binary message
Sourcepub const OP_CODE_CLOSE: u8 = 8u8
pub const OP_CODE_CLOSE: u8 = 8u8
Operation code for a close request message
Sourcepub const OP_CODE_PING: u8 = 9u8
pub const OP_CODE_PING: u8 = 9u8
Operation code for a ping message
Sourcepub const OP_CODE_PONG: u8 = 10u8
pub const OP_CODE_PONG: u8 = 10u8
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 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