[−][src]Struct yarws::TextSocket
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
impl !RefUnwindSafe for TextSocket
impl Send for TextSocket
impl Sync for TextSocket
impl Unpin for TextSocket
impl !UnwindSafe for TextSocket
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,