pub struct Subscriber<T, E = Error> { /* private fields */ }
Expand description
New PUB-SUB subscriber.
Implementations§
Source§impl<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>>, UnboundedReceiver<String>)
pub fn new_test<M: Into<String>>( method: M, ) -> (Self, Receiver<Result<SubscriptionId, Error>>, UnboundedReceiver<String>)
Create new subscriber for tests.
Sourcepub async fn reject_async(self, error: Error) -> Result<(), ()>
pub async fn reject_async(self, error: Error) -> Result<(), ()>
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 async fn assign_id_async(self, id: SubscriptionId) -> Result<Sink<T, E>, ()>
pub async fn assign_id_async(self, id: SubscriptionId) -> Result<Sink<T, E>, ()>
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> Freeze for Subscriber<T, E>
impl<T, E = Error> !RefUnwindSafe for Subscriber<T, E>
impl<T, E> Send for Subscriber<T, E>
impl<T, E> Sync for Subscriber<T, E>
impl<T, E> Unpin for Subscriber<T, E>
impl<T, E = Error> !UnwindSafe for Subscriber<T, E>
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