ratkit 0.2.14

A comprehensive collection of reusable TUI components for ratatui including resizable splits, tree views, markdown rendering, toast notifications, dialogs, and terminal embedding
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::io::{self, Write};

use crate::primitives::termtui::vt100::{BufferView, ScreenDiffer};

pub fn write_screen_diff<V: BufferView, W: Write>(
    differ: &mut ScreenDiffer,
    view: &V,
    out: &mut W,
) -> io::Result<()> {
    let mut buffer = String::new();
    differ
        .diff(&mut buffer, view)
        .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
    out.write_all(buffer.as_bytes())
}