pub struct SignalManager { /* private fields */ }Expand description
Runtime signal manager.
Implementations§
Source§impl SignalManager
impl SignalManager
Sourcepub fn new() -> SignalManager
pub fn new() -> SignalManager
Create a new signal manager.
Sourcepub fn handle<F>(
&self,
signal: i32,
handler: F,
) -> Result<SignalRegistration, SignalManagerError>
pub fn handle<F>( &self, signal: i32, handler: F, ) -> Result<SignalRegistration, SignalManagerError>
Register a handler for a specific signal number.
Returns a registration guard that unregisters on drop.
Sourcepub fn on_shutdown<F>(&self, hook: F)
pub fn on_shutdown<F>(&self, hook: F)
Append a shutdown hook (executed in LIFO order).
Sourcepub fn enable_double_tap(&self, config: DoubleTapConfig)
pub fn enable_double_tap(&self, config: DoubleTapConfig)
Enable SIGINT double-tap behavior.
Sourcepub fn disable_double_tap(&self)
pub fn disable_double_tap(&self)
Disable SIGINT double-tap behavior.
Sourcepub fn set_endpoint_logger<F>(&self, logger: F)
pub fn set_endpoint_logger<F>(&self, logger: F)
Install a callback invoked for every processed /admin/signal request.
Sourcepub fn clear_endpoint_logger(&self)
pub fn clear_endpoint_logger(&self)
Remove the endpoint request logger callback.
Sourcepub fn handle_admin_signal_request(
&self,
request: SignalEndpointRequest,
) -> SignalEndpointResponse
pub fn handle_admin_signal_request( &self, request: SignalEndpointRequest, ) -> SignalEndpointResponse
Process a POST /admin/signal request body.
Sourcepub fn handle_admin_signal_request_with_metadata(
&self,
request: SignalEndpointRequest,
metadata: SignalEndpointMetadata,
) -> SignalEndpointResponse
pub fn handle_admin_signal_request_with_metadata( &self, request: SignalEndpointRequest, metadata: SignalEndpointMetadata, ) -> SignalEndpointResponse
Process a POST /admin/signal request body with HTTP-derived metadata.
Sourcepub fn supports(&self, signal: i32) -> bool
pub fn supports(&self, signal: i32) -> bool
Check whether a signal is supported on the current platform.
Sourcepub fn listen(&self) -> Result<(), SignalManagerError>
pub fn listen(&self) -> Result<(), SignalManagerError>
Start listening for OS and injected signals.
This call blocks until SignalManager::stop is called or a shutdown
signal is processed.
Trait Implementations§
Source§impl Clone for SignalManager
impl Clone for SignalManager
Source§fn clone(&self) -> SignalManager
fn clone(&self) -> SignalManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for SignalManager
impl Default for SignalManager
Source§fn default() -> SignalManager
fn default() -> SignalManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SignalManager
impl RefUnwindSafe for SignalManager
impl Send for SignalManager
impl Sync for SignalManager
impl Unpin for SignalManager
impl UnsafeUnpin for SignalManager
impl UnwindSafe for SignalManager
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