Struct ws_tool::codec::FrameReadState
source · pub struct FrameReadState { /* private fields */ }Expand description
websocket read state
Implementations§
source§impl FrameReadState
impl FrameReadState
sourcepub fn with_remain(config: FrameConfig, read_data: BytesMut) -> Self
pub fn with_remain(config: FrameConfig, read_data: BytesMut) -> Self
construct with config and bytes remaining in handshake
sourcepub fn with_config(config: FrameConfig) -> Self
pub fn with_config(config: FrameConfig) -> Self
construct with config
sourcepub fn is_header_ok(&self) -> bool
pub fn is_header_ok(&self) -> bool
check if data in buffer is enough to parse frame header
sourcepub fn get_leading_bits(&self) -> u8
pub fn get_leading_bits(&self) -> u8
return current frame header bits of buffer
sourcepub fn parse_frame_header(&mut self) -> Result<usize, WsError>
pub fn parse_frame_header(&mut self) -> Result<usize, WsError>
try to parse frame header in buffer, return expected payload
sourcepub fn consume_frame(&mut self, len: usize) -> OwnedFrame
pub fn consume_frame(&mut self, len: usize) -> OwnedFrame
get a frame and reset state
sourcepub fn check_frame(
&mut self,
unmasked_frame: OwnedFrame
) -> Result<Option<OwnedFrame>, WsError>
pub fn check_frame( &mut self, unmasked_frame: OwnedFrame ) -> Result<Option<OwnedFrame>, WsError>
perform protocol checking after receiving a frame
Trait Implementations§
source§impl Clone for FrameReadState
impl Clone for FrameReadState
source§fn clone(&self) -> FrameReadState
fn clone(&self) -> FrameReadState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more