pub struct SysSigReceiver { /* private fields */ }
Expand description
Listens for the machine shutdown signals via a SysSigListener with a broadcast::Receiver
.
Shutdown is signalled using a broadcast::Receiver
. Only a single value is
ever sent. Once a value has been sent via the broadcast channel, the server
should shutdown.
The Shutdown
struct listens for the signal and tracks that the signal has
been received. Callers may query for whether the shutdown signal has been
received or not.
Implementations§
Source§impl SysSigReceiver
impl SysSigReceiver
Sourcepub fn new(shutdown: Arc<AtomicBool>, notify: Receiver<()>) -> SysSigReceiver
pub fn new(shutdown: Arc<AtomicBool>, notify: Receiver<()>) -> SysSigReceiver
Create a new Shutdown
backed by the given broadcast::Receiver
.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true
if the shutdown signal has been received.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SysSigReceiver
impl RefUnwindSafe for SysSigReceiver
impl Send for SysSigReceiver
impl Sync for SysSigReceiver
impl Unpin for SysSigReceiver
impl UnwindSafe for SysSigReceiver
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request