Crate unsegen_signals[][src]

Expand description

Use unsegen’s input module to raise signals on the usual key combinations (e.g., SIGINT on CTRL-C)

Example:

extern crate unsegen;
extern crate unsegen_signals;

use unsegen::input::*;
use unsegen_signals::*;

for input in Input::read_all(&[b'a', b'b', b'c', 0o32/*Ctrl-Z*/, 0x3 /*Ctrl-C*/][..]) {
    let input = input.unwrap();

    input
        // Will send SIGINT and panic the test!
        .chain(SignalBehavior::new().on_default::<SIGINT>())
        // But Ctrl-Z will pass through here, because have no handler for SIGTSTP
        .chain(|i: Input| {
            match i.event {
                Event::Key(Key::Char(c)) => println!("Char: {}", c),
                Event::Key(Key::Ctrl(c)) => println!("Ctrl: {}", c),
                _ => return Some(i),
            }
            None
        });
}

Structs

SIGINT

Type corresponding to SIGINT, by default triggered by Ctrl-Z.

SIGQUIT

Type corresponding to SIGQUIT, by default triggered by [Ctrl-](https://en.wikipedia.org/wiki/Ctrl-%5C).

SIGTSTP

Type corresponding to SIGTSTP, by default triggered by Ctrl-Z.

SignalBehavior

Raises signals which will be passed to the underlying terminal.

Traits

Signal

Every signal is described by a type that ties together its libc representation and a default Event (i.e., most likely, a key combination) that fires it.