Struct soketto::connection::Sender

source ·
pub struct Sender<T> { /* private fields */ }
Expand description

The sending half of a connection.

Implementations§

source§

impl<T: AsyncRead + AsyncWrite + Unpin> Sender<T>

source

pub async fn send_text(&mut self, data: impl AsRef<str>) -> Result<(), Error>

Send a text value over the websocket connection.

source

pub async fn send_text_owned(&mut self, data: String) -> Result<(), Error>

Send a text value over the websocket connection.

This method performs one copy fewer than Sender::send_text.

source

pub async fn send_binary(&mut self, data: impl AsRef<[u8]>) -> Result<(), Error>

Send some binary data over the websocket connection.

source

pub async fn send_binary_mut( &mut self, data: impl AsMut<[u8]> ) -> Result<(), Error>

Send some binary data over the websocket connection.

This method performs one copy fewer than Sender::send_binary. The data buffer may be modified by this method, e.g. if masking is necessary.

source

pub async fn send_ping(&mut self, data: ByteSlice125<'_>) -> Result<(), Error>

Ping the remote end.

source

pub async fn send_pong(&mut self, data: ByteSlice125<'_>) -> Result<(), Error>

Send an unsolicited Pong to the remote.

source

pub async fn flush(&mut self) -> Result<(), Error>

Flush the socket buffer.

source

pub async fn close(&mut self) -> Result<(), Error>

Send a close message and close the connection.

Trait Implementations§

source§

impl<T: Debug> Debug for Sender<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Sender<T>

§

impl<T> Send for Sender<T>
where T: Send,

§

impl<T> Sync for Sender<T>
where T: Send,

§

impl<T> Unpin for Sender<T>

§

impl<T> !UnwindSafe for Sender<T>

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

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

source§

fn vzip(self) -> V