Expand description
Counting writer for tracking bytes emitted.
This module provides a wrapper around any Write implementation that
counts the number of bytes written. This is used to verify O(changes)
output size for diff-based rendering.
§Usage
use ftui_render::counting_writer::CountingWriter;
use std::io::Write;
let mut buffer = Vec::new();
let mut writer = CountingWriter::new(&mut buffer);
writer.write_all(b"Hello, world!").unwrap();
assert_eq!(writer.bytes_written(), 13);
writer.reset_counter();
writer.write_all(b"Hi").unwrap();
assert_eq!(writer.bytes_written(), 2);Structs§
- Counting
Writer - A write wrapper that counts bytes written.
- Present
Stats - Statistics from a present() operation.
- Stats
Collector - A stats collector for measuring present operations.
Constants§
- BYTES_
PER_ CELL_ MAX - Expected bytes per cell change (approximate worst case).
- BYTES_
PER_ CURSOR_ MOVE - Bytes for cursor move sequence (CUP).
- SYNC_
OVERHEAD - Bytes for sync output wrapper.
Functions§
- expected_
max_ bytes - Calculate expected maximum bytes for a frame with given changes.