#[non_exhaustive]pub enum Signal {
Int,
Term,
Hup,
Quit,
Usr1,
Usr2,
Kill,
}Expand description
A POSIX signal for Terminal::signal: the graceful-shutdown set.
Note the difference from typing: send(Key::Ctrl('c')) writes the
0x03 byte through the PTY (an app in raw mode reads it; in cooked
mode the line discipline turns it into SIGINT), while
signal(Signal::Int) delivers the signal directly via kill(2),
bypassing the terminal entirely.
Marked #[non_exhaustive]: these seven are the graceful-shutdown set,
not the signal set — POSIX has around thirty, and SIGWINCH,
SIGCONT, SIGTSTP and SIGPIPE are all things a terminal
application reacts to. Like Key, a Signal is
constructed rather than matched, so the attribute leaves room for those
without spending a major version on each. Naming every variant is
therefore still not exhaustive:
fn number(s: Signal) -> u8 {
match s {
Signal::Int => 2,
Signal::Quit => 3,
Signal::Kill => 9,
Signal::Term => 15,
Signal::Hup => 1,
Signal::Usr1 => 10,
Signal::Usr2 => 12,
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Int
SIGINT — interactive interrupt (what Ctrl-C means).
Term
SIGTERM — the polite termination request.
Hup
SIGHUP — the controlling terminal hung up.
Quit
SIGQUIT — quit (often with a core dump).
Usr1
SIGUSR1 — user-defined; commonly “reload” or “toggle”.
Usr2
SIGUSR2 — user-defined.
Kill
SIGKILL — uncatchable. Prefer letting Drop clean up; send this
only to test how your supervisor reacts to a hard kill.
Trait Implementations§
impl Copy for Signal
impl Eq for Signal
impl StructuralPartialEq for Signal
Auto Trait Implementations§
impl Freeze for Signal
impl RefUnwindSafe for Signal
impl Send for Signal
impl Sync for Signal
impl Unpin for Signal
impl UnsafeUnpin for Signal
impl UnwindSafe for Signal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.