interruptor

Crates.iointerruptor
lib.rsinterruptor
version0.1.1
sourcesrc
created_at2021-11-03 16:53:19.789266
updated_at2022-04-11 17:21:02.627859
descriptionCollection of functions generating Unix process signal receivers for use in the Crossbeam Channel select! macro.
homepage
repositoryhttps://github.com/zduny/interruptor
max_upload_size
id476254
size17,010
Daniel Zduniak (zduny)

documentation

https://docs.rs/interruptor/

README

interruptor

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

Commit count: 9

cargo fmt