[][src]Struct yarws::TextSocket

pub struct TextSocket {
    pub no: usize,
    // some fields omitted
}

Represent a WebSocket connection. Used for sending and receiving text only messages.

Each incoming message is transformed into String. Eventual other types of the messages (binary) are ignored.

Fields

no: usize

Methods

impl TextSocket[src]

pub async fn send<'_, '_>(&'_ mut self, text: &'_ str) -> Result<(), Error>[src]

pub async fn recv<'_>(&'_ mut self) -> Option<String>[src]

Receives String from the other side of the Socket connection. None is returned if the socket is closed.

pub async fn try_recv<'_>(&'_ mut self) -> Result<String, Error>[src]

Sends String to the other side of the Socket connection. Errors if the socket is already closed.

pub async fn into_channel(self) -> (Sender<String>, Receiver<String>)[src]

Transforms Socket into pair of mpsc channels for sending/receiving Strings.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,