Struct jsonrpc_pubsub::Subscriber
source · [−]pub struct Subscriber { /* private fields */ }
Expand description
Represents a subscribing client. Subscription handlers can either reject this subscription request or assign an unique id.
Implementations
sourceimpl Subscriber
impl Subscriber
sourcepub fn new_test<T: Into<String>>(
method: T
) -> (Self, Receiver<Result<SubscriptionId, Error>>, Receiver<String>)
pub fn new_test<T: Into<String>>(
method: T
) -> (Self, Receiver<Result<SubscriptionId, Error>>, Receiver<String>)
Creates new subscriber.
Should only be used for tests.
sourcepub fn assign_id(self, id: SubscriptionId) -> Result<Sink, ()>
pub fn assign_id(self, id: SubscriptionId) -> Result<Sink, ()>
Consumes Subscriber
and assigns unique id to a requestor.
Returns Err
if request has already terminated.
sourcepub fn assign_id_async(
self,
id: SubscriptionId
) -> impl Future<Item = Sink, Error = ()>
pub fn assign_id_async(
self,
id: SubscriptionId
) -> impl Future<Item = Sink, Error = ()>
Consumes Subscriber
and assigns unique id to a requestor.
The returned Future
resolves when the subscriber receives subscription id.
Resolves to Err
if request has already terminated.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Subscriber
impl Send for Subscriber
impl Sync for Subscriber
impl Unpin for Subscriber
impl !UnwindSafe for Subscriber
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more