Name

Enum Name 

Source
#[non_exhaustive]
pub enum Name {
Show 40 variants Abrt, Alrm, Bus, Chld, Cld, Cont, Emt, Fpe, Hup, Ill, Info, Int, Io, Iot, Kill, Lost, Pipe, Poll, Prof, Pwr, Quit, Segv, Stkflt, Stop, Sys, Term, Thr, Trap, Tstp, Ttin, Ttou, Urg, Usr1, Usr2, Vtalrm, Winch, Xcpu, Xfsz, Rtmin(RawNumber), Rtmax(RawNumber),
}
Expand description

Signal name

This enum identifies a signal by its name. It can be used to represent signals regardless of whether they are available on the System.

Use the System::validate_signal function to obtain a Name from a signal number. The System::signal_number_from_name function can be used to convert a Name to a Number.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Abrt

SIGABRT (process abort signal)

§

Alrm

SIGALRM (alarm clock)

§

Bus

SIGBUS (access to an undefined portion of a memory object)

§

Chld

SIGCHLD (child process terminated, stopped, or continued)

§

Cld

SIGCLD (child process terminated, stopped, or continued)

§

Cont

SIGCONT (continue executing, if stopped)

§

Emt

SIGEMT (emulation trap)

§

Fpe

SIGFPE (erroneous arithmetic operation)

§

Hup

SIGHUP (hangup)

§

Ill

SIGILL (illegal instruction)

§

Info

SIGINFO (status request from keyboard)

§

Int

SIGINT (interrupt)

§

Io

SIGIO (I/O is possible on a file descriptor)

§

Iot

SIGIOT (I/O trap)

§

Kill

SIGKILL (kill)

§

Lost

SIGLOST (resource lost)

§

Pipe

SIGPIPE (write on a pipe with no one to read it)

§

Poll

SIGPOLL (pollable event)

§

Prof

SIGPROF (profiling timer expired)

§

Pwr

SIGPWR (power failure)

§

Quit

SIGQUIT (quit)

§

Segv

SIGSEGV (invalid memory reference)

§

Stkflt

SIGSTKFLT (stack fault)

§

Stop

SIGSTOP (stop executing)

§

Sys

SIGSYS (bad system call)

§

Term

SIGTERM (termination)

§

Thr

SIGTHR (thread interrupt)

§

Trap

SIGTRAP (trace trap)

§

Tstp

SIGTSTP (stop executing)

§

Ttin

SIGTTIN (background process attempting read)

§

Ttou

SIGTTOU (background process attempting write)

§

Urg

SIGURG (high bandwidth data is available at a socket)

§

Usr1

SIGUSR1 (user-defined signal 1)

§

Usr2

SIGUSR2 (user-defined signal 2)

§

Vtalrm

SIGVTALRM (virtual timer expired)

§

Winch

SIGWINCH (window size change)

§

Xcpu

SIGXCPU (CPU time limit exceeded)

§

Xfsz

SIGXFSZ (file size limit exceeded)

§

Rtmin(RawNumber)

Real-time signal with a number relative to the minimum real-time signal

Rtmin(n) represents the real-time signal SIGRTMIN + n, where n is expected to be a non-negative integer between 0 and SIGRTMAX - SIGRTMIN.

§

Rtmax(RawNumber)

Real-time signal with a number relative to the maximum real-time signal

Rtmax(n) represents the real-time signal SIGRTMAX + n, where n is expected to be a non-positive integer between SIGRTMIN - SIGRTMAX and 0.

Implementations§

Source§

impl Name

Source

pub fn iter() -> NameIter

Returns an iterator over all signal names.

This is a convenience method that returns an iterator over all signal names. The iterator yields all signal names other than Rtmin and Rtmax in the alphabetical order, followed by Rtmin(0) and Rtmax(0) as the last two items.

Note that the iterator works independently of the underlying system and does not check whether the signals are available on the system.

Source

pub fn as_string(&self) -> Cow<'static, str>

Returns the name as a string.

For most signals, this function returns a static string that is the signal name in uppercase without the "SIG" prefix. For real-time signals Rtmin(n) and Rtmax(n) where n is non-zero, this function returns a dynamically allocated string that is RTMIN or RTMAX followed by the relative number n. Examples of the returned strings are "TERM", "RTMIN", and "RTMAX-5".

The returned name can be converted back to the signal using the FromStr implementation for Name.

Trait Implementations§

Source§

impl Clone for Name

Source§

fn clone(&self) -> Name

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Name

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Name

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Writes the signal name to the formatter.

See Name::as_string for the format of the produced string.

Source§

impl FromStr for Name

Parses a signal name from a string.

This function parses a signal name from a string. The input string is expected to be an uppercase signal name without the "SIG" prefix. The function returns the corresponding signal name if the input string matches a known signal name. Otherwise, it returns an error.

See Name::as_string for the format of the input string.

Source§

type Err = UnknownNameError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, UnknownNameError>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Name

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoEnumIterator for Name

Source§

impl PartialEq for Name

Source§

fn eq(&self, other: &Name) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Name

Compares two signal names.

The comparison is allowed only between two Rtmin values or two Rtmax values. The comparison is based on the numerical value of the signal number.

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Name

Source§

impl Eq for Name

Source§

impl StructuralPartialEq for Name

Auto Trait Implementations§

§

impl Freeze for Name

§

impl RefUnwindSafe for Name

§

impl Send for Name

§

impl Sync for Name

§

impl Unpin for Name

§

impl UnwindSafe for Name

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.