pub enum SignalHandler {
Default,
Ignore,
Hook(SignalHook),
NoReturnHook(NoReturnSignalHook),
}
signals
only.Expand description
A signal handling method.
Variants§
Default
Use the default behavior specified by the C standard.
Ignore
Ignore the signal whenever it is received.
Hook(SignalHook)
Call a function whenever the signal is received. The function can return, execution will continue.
NoReturnHook(NoReturnSignalHook)
Call a function whenever the signal is received. The function must not return.
Implementations§
Source§impl SignalHandler
impl SignalHandler
Sourcepub const fn is_default(self) -> bool
pub const fn is_default(self) -> bool
Returns true
for the Default
variant, false
otherwise.
Sourcepub const fn is_hook(self) -> bool
pub const fn is_hook(self) -> bool
Returns true
for the Hook
and NoReturnHook
variants, false
otherwise.
Sourcepub unsafe fn from_fn(function: fn()) -> Self
pub unsafe fn from_fn(function: fn()) -> Self
Creates a handler which calls the specified function.
§Safety
The function must not call any C functions which are not considered signal-safe. See the module-level section on signal-safe C functions for more.
Sourcepub unsafe fn from_fn_noreturn(function: fn() -> !) -> Self
pub unsafe fn from_fn_noreturn(function: fn() -> !) -> Self
Creates a handler which calls the specified function and is known to never return.
§Safety
The function must not call any C functions which are not considered signal-safe. See the module-level section on signal-safe C functions for more.
Trait Implementations§
Source§impl Clone for SignalHandler
impl Clone for SignalHandler
Source§fn clone(&self) -> SignalHandler
fn clone(&self) -> SignalHandler
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SignalHandler
impl Debug for SignalHandler
Source§impl Default for SignalHandler
impl Default for SignalHandler
Source§fn default() -> Self
fn default() -> Self
Returns SignalHandler::Default
.