pub struct SubscriptionSink { /* private fields */ }
Expand description
Represents a single subscription that hasn’t been processed yet.
Implementations§
source§impl SubscriptionSink
impl SubscriptionSink
sourcepub fn subscription_id(&self) -> SubscriptionId<'static>
pub fn subscription_id(&self) -> SubscriptionId<'static>
Get the subscription ID.
sourcepub fn method_name(&self) -> &str
pub fn method_name(&self) -> &str
Get the method name.
sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Get the connection ID.
sourcepub async fn send(
&self,
msg: SubscriptionMessage,
) -> Result<(), DisconnectError>
pub async fn send( &self, msg: SubscriptionMessage, ) -> Result<(), DisconnectError>
Send out a response on the subscription and wait until there is capacity.
Returns
Ok(())
if the message could be sent.Err(unsent_msg)
if the connection or subscription was closed.
§Cancel safety
This method is cancel-safe and dropping a future loses its spot in the waiting queue.
sourcepub async fn send_timeout(
&self,
msg: SubscriptionMessage,
timeout: Duration,
) -> Result<(), SendTimeoutError>
pub async fn send_timeout( &self, msg: SubscriptionMessage, timeout: Duration, ) -> Result<(), SendTimeoutError>
Similar to SubscriptionSink::send
but only waits for a limited time.
sourcepub fn try_send(&mut self, msg: SubscriptionMessage) -> Result<(), TrySendError>
pub fn try_send(&mut self, msg: SubscriptionMessage) -> Result<(), TrySendError>
Attempts to immediately send out the message as JSON string to the subscribers but fails if the channel is full or the connection/subscription is closed
This differs from SubscriptionSink::send
where it will until there is capacity
in the channel.
sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Get the max capacity of the subscription.
Trait Implementations§
source§impl Clone for SubscriptionSink
impl Clone for SubscriptionSink
source§fn clone(&self) -> SubscriptionSink
fn clone(&self) -> SubscriptionSink
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SubscriptionSink
impl Debug for SubscriptionSink
Auto Trait Implementations§
impl Freeze for SubscriptionSink
impl !RefUnwindSafe for SubscriptionSink
impl Send for SubscriptionSink
impl Sync for SubscriptionSink
impl Unpin for SubscriptionSink
impl !UnwindSafe for SubscriptionSink
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)