pub struct Sender<T>where
T: Serialize,{ /* private fields */ }Expand description
Used to send data to a stream.
Implementations§
§impl<T> Sender<T>where
T: Serialize,
impl<T> Sender<T>where T: Serialize,
pub fn send(&self, data: &T) -> Result<(), Sender>
pub fn send(&self, data: &T) -> Result<(), Sender>
Send data into the stream.
Errors
error::Sender::Serializeifdatafailed to be serializederror::Sender::Writeif theSenderfailed to to write to the streamerror::Sender::Closedif theSenderis closed
pub async fn finish(&self) -> impl Future<Output = Result<(), Sender>>
pub async fn finish(&self) -> impl Future<Output = Result<(), Sender>>
Shut down the Send part of the stream gracefully.
No new data may be written after calling this method. Completes when the peer has acknowledged all sent data, retransmitting data as needed.
Errors
This can only return error::Sender::Closed as an Err, if it was
already closed, but if the Sender failed to write to the stream it
will return a queued error::Sender::Write.
pub async fn close(&self) -> impl Future<Output = Result<(), Sender>>
pub async fn close(&self) -> impl Future<Output = Result<(), Sender>>
Close the Sender immediately.
To close a Sender gracefully use Sender::finish.
Errors
This can only return error::Sender::Closed as an Err, if it was
already closed, but if the Sender failed to write to the stream it
will return a queued error::Sender::Write.
Trait Implementations§
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: Sync,
impl<T> Unpin for Sender<T>where T: Unpin,
impl<T> !UnwindSafe for Sender<T>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more