Struct jsonrpc_pubsub::typed::Subscriber
source · [−]pub struct Subscriber<T, E = Error> { /* private fields */ }
Expand description
New PUB-SUB subscriber.
Implementations
sourceimpl<T, E> Subscriber<T, E>
impl<T, E> Subscriber<T, E>
sourcepub fn new(subscriber: Subscriber) -> Self
pub fn new(subscriber: Subscriber) -> Self
Wrap non-typed subscriber.
sourcepub fn new_test<M: Into<String>>(
method: M
) -> (Self, Receiver<Result<SubscriptionId, Error>>, Receiver<String>)
pub fn new_test<M: Into<String>>(
method: M
) -> (Self, Receiver<Result<SubscriptionId, Error>>, Receiver<String>)
Create new subscriber for tests.
sourcepub fn reject_async(self, error: Error) -> impl Future<Item = (), Error = ()>
pub fn reject_async(self, error: Error) -> impl Future<Item = (), Error = ()>
Reject subscription with given error.
The returned future will resolve when the response is sent to the client.
sourcepub fn assign_id(self, id: SubscriptionId) -> Result<Sink<T, E>, ()>
pub fn assign_id(self, id: SubscriptionId) -> Result<Sink<T, E>, ()>
Assign id to this subscriber.
This method consumes Subscriber
and returns Sink
if the connection is still open or error otherwise.
sourcepub fn assign_id_async(
self,
id: SubscriptionId
) -> impl Future<Item = Sink<T, E>, Error = ()>
pub fn assign_id_async(
self,
id: SubscriptionId
) -> impl Future<Item = Sink<T, E>, Error = ()>
Assign id to this subscriber.
This method consumes Subscriber
and resolves to Sink
if the connection is still open and the id has been sent or to error otherwise.
Trait Implementations
Auto Trait Implementations
impl<T, E = Error> !RefUnwindSafe for Subscriber<T, E>
impl<T, E> Send for Subscriber<T, E> where
E: Send,
T: Send,
impl<T, E> Sync for Subscriber<T, E> where
E: Sync,
T: Sync,
impl<T, E> Unpin for Subscriber<T, E> where
E: Unpin,
T: Unpin,
impl<T, E = Error> !UnwindSafe for Subscriber<T, E>
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