pub struct PendingSubscriptionSink { /* private fields */ }server only.Expand description
Represents a single subscription that is waiting to be accepted or rejected.
If this is dropped without calling PendingSubscription::reject or
PendingSubscriptionSink::accept a default error is sent out as response to the subscription
call.
Thus, if you want a customized error message then PendingSubscription::reject must be called.
Implementations§
Source§impl PendingSubscriptionSink
impl PendingSubscriptionSink
Sourcepub async fn reject(self, err: impl Into<ErrorObjectOwned>)
pub async fn reject(self, err: impl Into<ErrorObjectOwned>)
Reject the subscription by responding to the subscription method call with
the error message from [jsonrpsee_types::error::ErrorObject].
§Note
If this is used in the async subscription callback the return value is simply ignored because no further notification are propagated once reject has been called.
Sourcepub async fn accept(
self,
) -> Result<SubscriptionSink, PendingSubscriptionAcceptError>
pub async fn accept( self, ) -> Result<SubscriptionSink, PendingSubscriptionAcceptError>
Attempt to accept the subscription and respond the subscription method call.
§Errors
Fails if the connection is closed, or if the subscription response exceeds the
max_response_size. In the latter case the call is answered with an oversized response
error and the subscription is not registered.
Sourcepub fn subscription_id(&self) -> SubscriptionId<'static>
pub fn subscription_id(&self) -> SubscriptionId<'static>
Get the subscription ID.
Sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Returns connection identifier, which was used to perform pending subscription request
Sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Get the max capacity of the channel.
Sourcepub fn method_name(&self) -> &str
pub fn method_name(&self) -> &str
Get the method name.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PendingSubscriptionSink
impl !UnwindSafe for PendingSubscriptionSink
impl Freeze for PendingSubscriptionSink
impl Send for PendingSubscriptionSink
impl Sync for PendingSubscriptionSink
impl Unpin for PendingSubscriptionSink
impl UnsafeUnpin for PendingSubscriptionSink
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes