pub struct ResponseSender { /* private fields */ }Expand description
Encode Message into Bytes and send it to ResponseStream.
Implementations§
Source§impl ResponseSender
impl ResponseSender
Sourcepub fn downgrade(&self) -> ResponseWeakSender
pub fn downgrade(&self) -> ResponseWeakSender
downgrade Self to a weak sender.
Sourcepub async fn text(&self, txt: impl Into<Bytes>) -> Result<(), ProtocolError>
pub async fn text(&self, txt: impl Into<Bytes>) -> Result<(), ProtocolError>
encode Message::Text variant and add to ResponseStream.
Sourcepub fn binary(
&self,
bin: impl Into<Bytes>,
) -> impl Future<Output = Result<(), ProtocolError>> + '_
pub fn binary( &self, bin: impl Into<Bytes>, ) -> impl Future<Output = Result<(), ProtocolError>> + '_
encode Message::Binary variant and add to ResponseStream.
Sourcepub fn continuation(
&self,
item: Item,
) -> impl Future<Output = Result<(), ProtocolError>> + '_
pub fn continuation( &self, item: Item, ) -> impl Future<Output = Result<(), ProtocolError>> + '_
encode Message::Continuation variant and add to ResponseStream.
Sourcepub fn ping(
&self,
bin: impl Into<Bytes>,
) -> impl Future<Output = Result<(), ProtocolError>> + '_
pub fn ping( &self, bin: impl Into<Bytes>, ) -> impl Future<Output = Result<(), ProtocolError>> + '_
encode Message::Ping variant and add to ResponseStream.
Sourcepub fn pong(
&self,
bin: impl Into<Bytes>,
) -> impl Future<Output = Result<(), ProtocolError>> + '_
pub fn pong( &self, bin: impl Into<Bytes>, ) -> impl Future<Output = Result<(), ProtocolError>> + '_
encode Message::Pong variant and add to ResponseStream.
Sourcepub async fn close(
&mut self,
reason: Option<impl Into<CloseReason>>,
) -> Result<(), ProtocolError>
pub async fn close( &mut self, reason: Option<impl Into<CloseReason>>, ) -> Result<(), ProtocolError>
encode Message::Close variant and add to ResponseStream.
This method can only be executed once.
Concurrent callers would race for executing and at most one would succeed.
Other callers failing the race would observe ProtocolError::SendClosed
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResponseSender
impl RefUnwindSafe for ResponseSender
impl Send for ResponseSender
impl Sync for ResponseSender
impl Unpin for ResponseSender
impl UnsafeUnpin for ResponseSender
impl UnwindSafe for ResponseSender
Blanket Implementations§
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