pub struct SignalSvc;
Available on crate feature
bootstrap
only.Expand description
A [Service
] that listens for signals and cancels the context when a signal is received.
Trait Implementations§
Source§impl<Global: SignalConfig> Service<Global> for SignalSvc
impl<Global: SignalConfig> Service<Global> for SignalSvc
Source§fn enabled(
&self,
global: &Arc<Global>,
) -> impl Future<Output = Result<bool>> + Send
fn enabled( &self, global: &Arc<Global>, ) -> impl Future<Output = Result<bool>> + Send
Initialize the service and return
Ok(true)
if the service should be
run.Source§async fn run(self, global: Arc<Global>, ctx: Context) -> Result<()>
async fn run(self, global: Arc<Global>, ctx: Context) -> Result<()>
Run the service.
This function should return a future that is pending as long as the
service is running. When the service finishes without any errors,
the future should resolve to
Ok(())
. As a best practice, the
service should stop as soon as the provided context is done. Read moreimpl Copy for SignalSvc
Auto Trait Implementations§
impl Freeze for SignalSvc
impl RefUnwindSafe for SignalSvc
impl Send for SignalSvc
impl Sync for SignalSvc
impl Unpin for SignalSvc
impl UnwindSafe for SignalSvc
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