pub struct DeflateCodec<S: Read + Write> { /* private fields */ }
Expand description
recv/send deflate message
Implementations§
Source§impl<S: Read + Write> DeflateCodec<S>
impl<S: Read + Write> DeflateCodec<S>
Sourcepub fn new(
stream: S,
frame_config: FrameConfig,
pmd_config: Option<PMDConfig>,
is_server: bool,
) -> Self
pub fn new( stream: S, frame_config: FrameConfig, pmd_config: Option<PMDConfig>, is_server: bool, ) -> Self
construct method
Sourcepub fn factory(req: Request<()>, stream: S) -> Result<Self, WsError>
pub fn factory(req: Request<()>, stream: S) -> Result<Self, WsError>
used for server side to construct a new server
Sourcepub fn check_fn(
key: String,
resp: Response<()>,
stream: S,
) -> Result<Self, WsError>
pub fn check_fn( key: String, resp: Response<()>, stream: S, ) -> Result<Self, WsError>
used for client side to construct a new client
Sourcepub fn stream_mut(&mut self) -> &mut S
pub fn stream_mut(&mut self) -> &mut S
get mutable underlying stream
Sourcepub fn send_owned_frame(&mut self, frame: OwnedFrame) -> Result<(), WsError>
pub fn send_owned_frame(&mut self, frame: OwnedFrame) -> Result<(), WsError>
send a read frame, this method will not check validation of frame and do not fragment
Sourcepub fn send(&mut self, code: OpCode, payload: &[u8]) -> Result<(), WsError>
pub fn send(&mut self, code: OpCode, payload: &[u8]) -> Result<(), WsError>
send payload
will auto fragment before compression if auto_fragment_size > 0
Sourcepub fn binary(&mut self, data: &[u8]) -> Result<(), WsError>
pub fn binary(&mut self, data: &[u8]) -> Result<(), WsError>
helper function to send binary message
Sourcepub fn ping(&mut self, data: &[u8]) -> Result<(), WsError>
pub fn ping(&mut self, data: &[u8]) -> Result<(), WsError>
helper function to send ping message
Sourcepub fn pong(&mut self, data: &[u8]) -> Result<(), WsError>
pub fn pong(&mut self, data: &[u8]) -> Result<(), WsError>
helper function to send ping message
Source§impl<R, W, S> DeflateCodec<S>
impl<R, W, S> DeflateCodec<S>
Sourcepub fn split(self) -> (DeflateRecv<R>, DeflateSend<W>)
pub fn split(self) -> (DeflateRecv<R>, DeflateSend<W>)
split codec to recv and send parts
Auto Trait Implementations§
impl<S> Freeze for DeflateCodec<S>where
S: Freeze,
impl<S> RefUnwindSafe for DeflateCodec<S>where
S: RefUnwindSafe,
impl<S> Send for DeflateCodec<S>where
S: Send,
impl<S> Sync for DeflateCodec<S>where
S: Sync,
impl<S> Unpin for DeflateCodec<S>where
S: Unpin,
impl<S> UnwindSafe for DeflateCodec<S>where
S: UnwindSafe,
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