pub struct Number(/* private fields */);Expand description
Signal number
This is a wrapper type for signal numbers. It is guaranteed to be a positive
integer, so it optimizes the size of Option<Number>, etc.
To make sure that all Numbers are valid, you can only obtain a Number
from an instance of System. Use the System::validate_signal and
System::signal_number_from_name methods to create a Number from a raw
signal number or a signal name, respectively.
Signal numbers are specific to the underlying system. Passing a signal
number obtained from RealSystem to VirtualSystem (or vice versa) is
not supported and may result in unexpected behavior, though it is not
checked by the type system.
Implementations§
Source§impl Number
impl Number
Sourcepub const fn as_raw_non_zero(self) -> NonZero<RawNumber>
pub const fn as_raw_non_zero(self) -> NonZero<RawNumber>
Returns the raw signal number as a NonZero<RawNumber>.
Sourcepub const fn from_raw_unchecked(raw: NonZero<RawNumber>) -> Self
pub const fn from_raw_unchecked(raw: NonZero<RawNumber>) -> Self
Creates a new Number from a raw signal number.
This is a backdoor method that allows creating a Number from an
arbitrary raw signal number. The caller must ensure that the raw signal
number is a valid signal number.
This function is not marked unsafe because creating an invalid
Number does not lead to undefined behavior. However, it is not
recommended to use this function unless you are sure that the raw signal
number is valid. To make sure that all Numbers are valid, use the
System::validate_signal and System::signal_number_from_name
methods instead.
Trait Implementations§
Source§impl From<Number> for ExitStatus
Converts a signal number to the corresponding exit status.
impl From<Number> for ExitStatus
Converts a signal number to the corresponding exit status.
POSIX requires the exit status to be greater than 128. The current
implementation returns signal_number + 384.
See ExitStatus::to_signal for the reverse conversion.
Source§impl Ord for Number
impl Ord for Number
Source§impl PartialOrd for Number
impl PartialOrd for Number
impl Copy for Number
impl Eq for Number
impl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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