pub struct SignalsInfo<E: Exfiltrator = SignalOnly>(/* private fields */);
Expand description

A struct which mimics signal_hook::iterator::SignalsInfo but also allows usage together with MIO runtime.

Implementations§

source§

impl<E: Exfiltrator> SignalsInfo<E>

source

pub fn new<I, S>(signals: I) -> Result<Self, Error>where I: IntoIterator<Item = S>, S: Borrow<c_int>, E: Default,

Create a Signals instance.

This registers all the signals listed. The same restrictions (panics, errors) apply as with Handle::add_signal.

source

pub fn with_exfiltrator<I, S>(signals: I, exfiltrator: E) -> Result<Self, Error>where I: IntoIterator<Item = S>, S: Borrow<c_int>,

A constructor with specifying an exfiltrator to pass information out of the signal handlers.

source

pub fn add_signal(&self, signal: c_int) -> Result<(), Error>

Registers another signal to the set watched by this Signals instance.

The same restrictions (panics, errors) apply as with Handle::add_signal.

source

pub fn pending(&mut self) -> Pending<E>

Returns an iterator of already received signals.

This returns an iterator over all the signal numbers of the signals received since last time they were read (out of the set registered by this Signals instance). Note that they are returned in arbitrary order and a signal number is returned only once even if it was received multiple times.

This method returns immediately (does not block) and may produce an empty iterator if there are no signals ready. So you should register an instance of this struct at an instance of mio::Poll to query for readability of the underlying self pipe.

Auto Trait Implementations§

§

impl<E = SignalOnly> !RefUnwindSafe for SignalsInfo<E>

§

impl<E> Send for SignalsInfo<E>

§

impl<E> Sync for SignalsInfo<E>

§

impl<E> Unpin for SignalsInfo<E>

§

impl<E = SignalOnly> !UnwindSafe for SignalsInfo<E>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.