pub struct Parser;
Expand description
A struct representing a WebSocket frame.
Implementations§
source§impl Parser
impl Parser
sourcepub fn parse(
src: &mut BytesMut,
server: bool,
max_size: usize,
) -> Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError>
pub fn parse( src: &mut BytesMut, server: bool, max_size: usize, ) -> Result<Option<(bool, OpCode, Option<BytesMut>)>, ProtocolError>
Parse the input stream into a frame.
sourcepub fn parse_close_payload(payload: &[u8]) -> Option<CloseReason>
pub fn parse_close_payload(payload: &[u8]) -> Option<CloseReason>
Parse the payload of a close frame.
sourcepub fn write_message<B: AsRef<[u8]>>(
dst: &mut BytesMut,
pl: B,
op: OpCode,
fin: bool,
mask: bool,
)
pub fn write_message<B: AsRef<[u8]>>( dst: &mut BytesMut, pl: B, op: OpCode, fin: bool, mask: bool, )
Generate binary representation
sourcepub fn write_close(dst: &mut BytesMut, reason: Option<CloseReason>, mask: bool)
pub fn write_close(dst: &mut BytesMut, reason: Option<CloseReason>, mask: bool)
Create a new Close control frame.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
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