#[non_exhaustive]pub enum Signal {
Terminate,
Interrupt,
Quit,
Hangup,
Pipe,
User1,
User2,
}Expand description
A platform-neutral signal identifier.
Variants map to their nearest platform equivalent. On Unix the mapping is direct (SIGTERM, SIGINT, etc.). On Windows the mapping is to Windows console control events:
| Variant | Unix | Windows |
|---|---|---|
Terminate | SIGTERM | CTRL_CLOSE_EVENT |
Interrupt | SIGINT | CTRL_C_EVENT |
Quit | SIGQUIT | CTRL_BREAK_EVENT |
Hangup | SIGHUP | CTRL_SHUTDOWN_EVENT |
Pipe | SIGPIPE | inert |
User1 | SIGUSR1 | inert |
User2 | SIGUSR2 | inert |
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Terminate
SIGTERM on Unix, CTRL_CLOSE_EVENT on Windows.
Interrupt
SIGINT (Ctrl+C) on Unix, CTRL_C_EVENT on Windows.
Quit
SIGQUIT on Unix, CTRL_BREAK_EVENT on Windows.
Hangup
SIGHUP on Unix, CTRL_SHUTDOWN_EVENT on Windows.
Pipe
SIGPIPE (Unix only; inert on Windows).
User1
SIGUSR1 (Unix only; inert on Windows).
User2
SIGUSR2 (Unix only; inert on Windows).
Implementations§
Source§impl Signal
impl Signal
Sourcepub const fn description(self) -> &'static str
pub const fn description(self) -> &'static str
Human-readable description used by Display and logging.
Sourcepub const fn unix_number(self) -> Option<i32>
pub const fn unix_number(self) -> Option<i32>
Unix signal number for this variant. Returns None for
variants that have no canonical Unix number (none currently,
but the API reserves the right to add Windows-only variants).
Sourcepub const fn is_unix_only(self) -> bool
pub const fn is_unix_only(self) -> bool
Returns true for variants that have no Windows analog.
Sourcepub const fn available_on_current_platform(self) -> bool
pub const fn available_on_current_platform(self) -> bool
Returns true if installing a handler for this signal is
expected to succeed on the platform this binary is running on.