Crate tokio_terminal_resize

Source
Expand description

Implements a stream of terminal resize events.

§Overview

Whenever the user resizes their terminal, a notification is sent to the application running in it. This crate provides those notifications in the form of a stream.

§Synopsis

let stream = tokio_terminal_resize::resizes().flatten_stream();
let prog = stream
    .for_each(|(rows, cols)| {
        println!("terminal is now {}x{}", cols, rows);
        Ok(())
    })
    .map_err(|e| eprintln!("error: {}", e));
tokio::run(prog);

Structs§

ResizeFuture
Future which sets up the terminal size stream
ResizeStream
Stream which returns the new terminal size every time it changes

Enums§

Error
Errors returned by this crate.

Functions§

resizes
Creates a stream which receives the new terminal size every time the user’s terminal is resized.