Expand description
§chunk-flush
Flush-on-newline buffer for streaming LLM output. Holds chars until
either a newline arrives or max_pending_chars is exceeded, then
emits the buffered chunk.
The point: keep the UI/log from churning on every single token delta, without making it laggy on long lines.
§Example
use chunk_flush::Flusher;
let mut f = Flusher::new(500);
assert_eq!(f.push("hello"), None); // no \n yet, under cap
assert_eq!(f.push(" world\n").as_deref(), Some("hello world\n"));Structs§
- Flusher
- Streaming buffer with flush-on-newline + size cap.