interruptor 0.1.1

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::time::Duration;

use crossbeam_channel::{select, tick};
use interruptor::interruption_or_termination;

fn main() {
    let tick = tick(Duration::from_secs(1));
    let stop = interruption_or_termination();

    loop {
        select! {
            recv(tick) -> _ => println!("Running!"),
            recv(stop) -> _ => break,
        }
    }
}