[][src]Function wintrap::trap_stream

pub fn trap_stream<RT: Sized>(
    signals: &'static [Signal],
    body: impl FnOnce(SignalStream) -> RT
) -> Result<RT, Error>

Traps one or more Signals into a SignalStream. During the execution of the body function, all signals specified will be yielded as items in the stream.

Arguments

  • signals - A list of signals to trap during the execution of body.

  • body - A function which accepts a SignalStream that generates the specified signals in the order they are received.