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§
Source§impl Subscriber
impl Subscriber
Sourcepub fn new_test<T: Into<String>>(
method: T,
) -> (Self, Receiver<Result<SubscriptionId, Error>>, UnboundedReceiver<String>)
pub fn new_test<T: Into<String>>( method: T, ) -> (Self, Receiver<Result<SubscriptionId, Error>>, UnboundedReceiver<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<Output = Result<Sink, ()>>
pub fn assign_id_async( self, id: SubscriptionId, ) -> impl Future<Output = Result<Sink, ()>>
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 Freeze for Subscriber
impl !RefUnwindSafe for Subscriber
impl Send for Subscriber
impl Sync for Subscriber
impl Unpin for Subscriber
impl !UnwindSafe for Subscriber
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