Struct signal_hook::iterator::backend::SignalIterator
source · pub struct SignalIterator<SD, E: Exfiltrator> { /* private fields */ }
iterator
only.Expand description
An infinite iterator of received signals.
Implementations§
source§impl<SD, E: Exfiltrator> SignalIterator<SD, E>
impl<SD, E: Exfiltrator> SignalIterator<SD, E>
sourcepub fn new<R>(signals: SD) -> Selfwhere
SD: BorrowMut<SignalDelivery<R, E>>,
R: 'static + AsRawFd + Send + Sync,
pub fn new<R>(signals: SD) -> Selfwhere SD: BorrowMut<SignalDelivery<R, E>>, R: 'static + AsRawFd + Send + Sync,
Create a new infinite iterator for signals registered with the passed
in SignalDelivery
instance.
sourcepub fn poll_signal<R, F>(
&mut self,
has_signals: &mut F
) -> PollResult<E::Output>where
SD: BorrowMut<SignalDelivery<R, E>>,
R: 'static + AsRawFd + Send + Sync,
F: FnMut(&mut R) -> Result<bool, Error>,
pub fn poll_signal<R, F>( &mut self, has_signals: &mut F ) -> PollResult<E::Output>where SD: BorrowMut<SignalDelivery<R, E>>, R: 'static + AsRawFd + Send + Sync, F: FnMut(&mut R) -> Result<bool, Error>,
Return a signal if there is one or tell the caller that there is none at the moment.
You have to pass in a callback which checks the underlying reading end of the pipe if
there may be any pending signals. This callback may or may not block. If the callback
returns true
this method will try to fetch the next signal and return it as a
PollResult::Signal
. If the callback returns false
the method will return
PollResult::Pending
and assume it will be called again at a later point in time.
The callback may be called any number of times by this function.
If the iterator was closed by the close
method of the associated
Handle
this method will return PollResult::Closed
.