| Crates.io | vt-push-parser |
| lib.rs | vt-push-parser |
| version | 0.13.1 |
| created_at | 2025-08-13 14:14:02.483533+00 |
| updated_at | 2025-12-12 01:16:37.692343+00 |
| description | A streaming push parser for the VT/xterm output events |
| homepage | |
| repository | https://github.com/mmastrac/vt-push-parser |
| max_upload_size | |
| id | 1793653 |
| size | 154,818 |
A streaming push parser for the VT protocol.
This crate provides a push parser that can be fed bytes and will emit events as they are parsed. You can easily use this as part of a push or pull pipeline.
This crate will eventually be zero-alloc, but currently it is not zero-alloc in all cases.
use vt_push_parser::{VTPushParser, event::VTEvent};
let mut parser = VTPushParser::new();
// Parse ANSI colored text
parser.feed_with(b"\x1b[32mHello\x1b[0m, world!", |event: VTEvent| {
match event {
VTEvent::Csi(csi) if csi.final_byte == b'm' => {
println!("SGR sequence: {:?}", csi.params);
}
VTEvent::Raw(text) => {
println!("Text: {}", String::from_utf8_lossy(text));
}
_ => {}
}
});