Struct tokio_shutdown::Listener
source · [−]pub struct Listener<R: Clone = (), A = ()> {
pub(crate) b_receiver: Receiver<R>,
pub(crate) mpsc_sender: UnboundedSender<A>,
pub(crate) shutdown_reason: Option<ShutdownReason<R>>,
}
Expand description
Generics
See Broadcaster
for documentation on the generic args.
Fields
b_receiver: Receiver<R>
mpsc_sender: UnboundedSender<A>
shutdown_reason: Option<ShutdownReason<R>>
Implementations
sourceimpl<R: Clone, I> Listener<R, I>
impl<R: Clone, I> Listener<R, I>
sourcepub async fn recv(&mut self) -> &ShutdownReason<R>
pub async fn recv(&mut self) -> &ShutdownReason<R>
Doesn’t return until a shutdown occurs.
sourcepub fn try_recv(&mut self) -> Option<&ShutdownReason<R>>
pub fn try_recv(&mut self) -> Option<&ShutdownReason<R>>
Returns None
if no shutdown has occurred, otherwise returns the shutdown
reason.
sourcepub fn into_reason(self) -> Option<ShutdownReason<R>>
pub fn into_reason(self) -> Option<ShutdownReason<R>>
Get the underlying shutdown reason, if present. Does not send any shut
sourcepub fn acknowledge(self, info: I) -> Option<ShutdownReason<R>>
pub fn acknowledge(self, info: I) -> Option<ShutdownReason<R>>
Block until an acknowledgement of the shutdown is sent. It is possible
for the Broadcaster
to have already closed.
Returns
Returns the original shutdown reason, if any.
Auto Trait Implementations
impl<R = (), A = ()> !RefUnwindSafe for Listener<R, A>
impl<R, A> Send for Listener<R, A>where
A: Send,
R: Send,
impl<R, A> Sync for Listener<R, A>where
A: Send,
R: Send + Sync,
impl<R, A> Unpin for Listener<R, A>where
R: Unpin,
impl<R = (), A = ()> !UnwindSafe for Listener<R, A>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more