pub struct WsWriter<W> { /* private fields */ }Expand description
Writing half. Not cancel-safe: do not race send_* futures in select!.
Implementations§
Source§impl<W: AsyncWrite + Unpin> WsWriter<W>
impl<W: AsyncWrite + Unpin> WsWriter<W>
pub fn new( io: W, role: Role, deflate: Option<(DeflateParams, DeflateConfig)>, ) -> Self
pub async fn send_text(&mut self, text: &str) -> Result<(), WsError>
pub async fn send_ping(&mut self, data: &[u8]) -> Result<(), WsError>
pub async fn send_pong(&mut self, data: &[u8]) -> Result<(), WsError>
Sourcepub async fn send_close(
&mut self,
code: u16,
reason: &str,
) -> Result<(), WsError>
pub async fn send_close( &mut self, code: u16, reason: &str, ) -> Result<(), WsError>
Sends a close frame. Further sends fail.
pub fn is_closed(&self) -> bool
pub async fn shutdown(&mut self) -> Result<(), WsError>
Auto Trait Implementations§
impl<W> Freeze for WsWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for WsWriter<W>where
W: RefUnwindSafe,
impl<W> Send for WsWriter<W>where
W: Send,
impl<W> Sync for WsWriter<W>where
W: Sync,
impl<W> Unpin for WsWriter<W>where
W: Unpin,
impl<W> UnsafeUnpin for WsWriter<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for WsWriter<W>where
W: 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