pub struct Signal(/* private fields */);Expand description
A signal number for use with kill_process, kill_process_group, and
kill_current_process_group.
For additional constructors such as Signal::rt_min
(aka libc::SIGRTMIN), Signal::rt_max (aka libc::SIGRTMAX),
Signal::rt (aka |n| libc::SIGRTMIN() + n), Signal::from_raw, and
Signal::from_raw_nonzero, see rustix-libc-wrappers.
§References
Implementations§
Source§impl Signal
impl Signal
Sourcepub const fn as_raw(self) -> i32
pub const fn as_raw(self) -> i32
Convert a Signal to a raw signal number.
To convert to a NonZeroI32, use Signal::as_raw_nonzero.
Sourcepub const fn as_raw_nonzero(self) -> NonZeroI32
pub const fn as_raw_nonzero(self) -> NonZeroI32
Convert a Signal to a raw non-zero signal number.
Sourcepub const unsafe fn from_raw_unchecked(sig: i32) -> Self
pub const unsafe fn from_raw_unchecked(sig: i32) -> Self
Convert a raw signal number into a Signal without checks.
For a safe checked version, see Signal::from_raw in
rustix-libc-wrappers.
§Safety
sig must be a valid and non-zero signal number.
And, if sig is a signal number reserved by the libc, such as a value
from the libc SIGRTMIN to the libc SIGRTMAX, inclusive, then
the resulting Signal must not be used to send, consume, or block any
signals or alter any signal handlers.
Sourcepub const unsafe fn from_raw_nonzero_unchecked(sig: NonZeroI32) -> Self
pub const unsafe fn from_raw_nonzero_unchecked(sig: NonZeroI32) -> Self
Convert a raw non-zero signal number into a Signal without checks.
For a safe checked version, see Signal::from_raw_nonzero in
rustix-libc-wrappers.
§Safety
sig must be a valid signal number.
And, if sig is a signal number reserved by the libc, such as a value
from SIGRTMIN to SIGRTMAX inclusive, then the resulting
Signal must not be used to send, consume, or block any signals or
alter any signal handlers.
Sourcepub const fn from_named_raw(sig: i32) -> Option<Self>
pub const fn from_named_raw(sig: i32) -> Option<Self>
Convert a raw named signal number into a Signal.
If the given signal number corresponds to one of the named constant
signal values, such as Signal::HUP or Signal::INT, return the
Signal value. Otherwise return None.
Signals in the range SIGRTMIN through SIGRTMAX are not supported by
this function. For a constructor that does recognize those values, see
Signal::from_raw in rustix-libc-wrappers.
Sourcepub const fn from_named_raw_nonzero(sig: NonZeroI32) -> Option<Self>
pub const fn from_named_raw_nonzero(sig: NonZeroI32) -> Option<Self>
Convert a raw non-zero named signal number into a Signal.
If the given signal number corresponds to one of the constant signal
values, such as Signal::HUP or Signal::INT, return the
Signal value. Otherwise return None.
Signals in the range SIGRTMIN through SIGRTMAX are not supported by
this function. For a constructor that does recognize those values, see
Signal::from_raw_nonzero in rustix-libc-wrappers.