zduny / interruptor

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.

Home Page:https://docs.rs/interruptor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

interruptor

Test Status Crate API

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.

example

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,
        }
    };
}

see also

Crossbeam

Crossbeam Channel

About

Collection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.

https://docs.rs/interruptor/

License:Apache License 2.0


Languages

Language:Rust 100.0%