pub enum SignalHandler {
Default,
Ignore,
Hook(SignalHook),
}
Available on Unix and crate feature
signals
only.Expand description
A signal handling method.
Variants§
Default
Use the default behavior specified by POSIX.
Ignore
Ignore the signal whenever it is received.
Hook(SignalHook)
Call a function whenever the signal is received.
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 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.
Trait Implementations§
Source§impl Clone for SignalHandler
impl Clone for SignalHandler
Source§fn clone(&self) -> SignalHandler
fn clone(&self) -> SignalHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
.
Source§impl From<SignalHook> for SignalHandler
impl From<SignalHook> for SignalHandler
Source§fn from(op: SignalHook) -> Self
fn from(op: SignalHook) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SignalHandler
impl PartialEq for SignalHandler
impl Copy for SignalHandler
impl Eq for SignalHandler
impl StructuralPartialEq for SignalHandler
Auto Trait Implementations§
impl Freeze for SignalHandler
impl RefUnwindSafe for SignalHandler
impl Send for SignalHandler
impl Sync for SignalHandler
impl Unpin for SignalHandler
impl UnwindSafe for SignalHandler
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