Skip to main content

WsWriter

Struct WsWriter 

Source
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>

Source

pub fn new( io: W, role: Role, deflate: Option<(DeflateParams, DeflateConfig)>, ) -> Self

Source

pub async fn send_text(&mut self, text: &str) -> Result<(), WsError>

Source

pub async fn send_ping(&mut self, data: &[u8]) -> Result<(), WsError>

Source

pub async fn send_pong(&mut self, data: &[u8]) -> Result<(), WsError>

Source

pub async fn send_close( &mut self, code: u16, reason: &str, ) -> Result<(), WsError>

Sends a close frame. Further sends fail.

Source

pub fn is_closed(&self) -> bool

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.