Skip to main content

WsReader

Struct WsReader 

Source
pub struct WsReader<R> { /* private fields */ }
Expand description

Reading half. WsReader::recv is cancel-safe: all progress is kept in self, so it can be used as a tokio::select! branch.

Implementations§

Source§

impl<R: AsyncRead + Unpin> WsReader<R>

Source

pub fn new( io: R, role: Role, cfg: WsConfig, deflate: Option<DeflateParams>, initial: Vec<u8>, ) -> Self

Source

pub async fn recv(&mut self) -> Result<Option<Message>, WsError>

Receives the next message. Ok(None) means the TCP stream ended.

Auto Trait Implementations§

§

impl<R> Freeze for WsReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for WsReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for WsReader<R>
where R: Send,

§

impl<R> Sync for WsReader<R>
where R: Sync,

§

impl<R> Unpin for WsReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for WsReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for WsReader<R>
where R: 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.