#[non_exhaustive]pub enum QuitSource {
Application,
UserQuit,
SessionEnd,
Signal,
}Expand description
Where a quit request came from, read by a close guard or the
application’s on_quit_requested guard through
EventContext::quit_source.
A guard that asks the user before closing can skip its dialog when the
user is not there to answer: for SessionEnd and
Signal it saves directly and lets the close go ahead,
as AppKit and Qt applications do when the session is ending.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Application
The application asked: ctx.quit(), ctx.quit_forced(), or the App
menu’s Quit row.
UserQuit
The user quit from outside the application’s own controls: macOS’s
Dock menu Quit, AppleScript’s quit, or another terminate:; on
Windows, taskkill without /F reaching the event loop’s hidden
window while a window of the application is open. A guarded quit: a
guard can ask, and refuse.
SessionEnd
The session ends (log out, restart, shut down). On macOS a guarded quit (AppKit waits for the answer, and a refusal cancels the logout); on Windows every guard is asked once and cannot refuse, since the session ends whatever the application answers.
Signal
A termination signal on Unix (SIGTERM, SIGHUP), heard while the
event loop runs; on Windows, taskkill without /F while no window
of the application is open, or the console it runs in closing.
Nobody is there to answer: every guard is asked once and cannot
refuse.