vt-push-parser

Crates.iovt-push-parser
lib.rsvt-push-parser
version0.13.1
created_at2025-08-13 14:14:02.483533+00
updated_at2025-12-12 01:16:37.692343+00
descriptionA streaming push parser for the VT/xterm output events
homepage
repositoryhttps://github.com/mmastrac/vt-push-parser
max_upload_size
id1793653
size154,818
Matt Mastracci (mmastrac)

documentation

README

vt-push-parser

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.

Zero-alloc

This crate will eventually be zero-alloc, but currently it is not zero-alloc in all cases.

Example

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));
        }
        _ => {}
    }
});
Commit count: 18

cargo fmt