Struct ws_tool::codec::BytesCodec
source · pub struct BytesCodec<S: Read + Write> { /* private fields */ }
Expand description
recv/send bytes message
Implementations§
source§impl<S: Read + Write> BytesCodec<S>
impl<S: Read + Write> BytesCodec<S>
sourcepub fn new_with(stream: S, config: FrameConfig) -> Self
pub fn new_with(stream: S, config: FrameConfig) -> Self
construct with stream & config
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 to 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 ping<'a>(&mut self, msg: &'a [u8]) -> Result<(), WsError>
pub fn ping<'a>(&mut self, msg: &'a [u8]) -> Result<(), WsError>
helper method to send ping message
sourcepub fn pong<'a>(&mut self, msg: &'a [u8]) -> Result<(), WsError>
pub fn pong<'a>(&mut self, msg: &'a [u8]) -> Result<(), WsError>
helper method to send pong message
sourcepub fn close<'a>(&mut self, code: u16, msg: &'a [u8]) -> Result<(), WsError>
pub fn close<'a>(&mut self, code: u16, msg: &'a [u8]) -> Result<(), WsError>
helper method to send close message
Auto Trait Implementations§
impl<S> RefUnwindSafe for BytesCodec<S>where
S: RefUnwindSafe,
impl<S> Send for BytesCodec<S>where
S: Send,
impl<S> Sync for BytesCodec<S>where
S: Sync,
impl<S> Unpin for BytesCodec<S>where
S: Unpin,
impl<S> UnwindSafe for BytesCodec<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