fast_output/
fast_output.rs

1use process_terminal::{
2    add_process, tprintln, utils::create_printing_process, KeyCode, MessageSettings,
3    ProcessSettings, ScrollSettings,
4};
5
6fn main() {
7    tprintln!("Starting...");
8
9    std::thread::sleep(std::time::Duration::from_secs(2));
10
11    let process_foo = create_printing_process(["   helloooohelloooohelloooohelloooohelloooohelloooohelloooohelloooohelloooo", "world", "foo", "bar"], 0.2, 50);
12
13    // Add the process to the terminal.
14    // The first time `add_process` or `tprintln!` is called, the terminal is automatically initialized.
15    add_process(
16        "Foo",
17        process_foo,
18        ProcessSettings::new_with_scroll(
19            // Show only the output messages.
20            MessageSettings::Output,
21            // Enable scrolling with the Left and Right keys.
22            // Up and Down keys are reserved for `Main` output.
23            ScrollSettings::enable(KeyCode::Left, KeyCode::Right),
24        ),
25    )
26    .unwrap();
27
28    loop {
29        std::thread::sleep(std::time::Duration::from_secs(1));
30    }
31}