| crate | purpose |
|---|---|
vtty |
the parser (re-exports vtty_core) |
vtty_core |
terminal model types + Perform |
vtty_codec |
no_std binary Encode/Decode codec for vtty_core |
vtty_width |
display cell width + emoji sequences |
vtty_grapheme |
UAX #29 grapheme cluster segmentation |
vtty_status |
OSC 7501 Program Status Protocol |
vtty_screen |
cell-grid terminal screen |
vtty_ffi |
raw C ABI |
vtty_bench |
throughput benchmarks |
- Safety —
#![forbid(unsafe_code)], nounwrap/expect/panic. - Zero-allocation — bulk
print_bytes/print_codepoints. no_std— optionalsimd/simd-transcodefeatures.- UTF-8 — maximal-subpart substitution; 8-bit C1 controls.
- Serialization — compact,
no_std, zero-allocationEncode/Decodecodec (vtty_codec) for events, replies, and terminal state.
cargo add vttyuse vtty::{Parser, Perform};
struct Screen;
impl Perform for Screen {
fn print_bytes(&mut self, s: &[u8]) { /* printable ASCII run */ }
fn print(&mut self, c: char) { /* non-ASCII code point */ }
fn execute(&mut self, b: u8) { /* \n \t \x1b … */ }
fn csi_dispatch(&mut self, params: &[i32], sep: u16, intermediates: &[u8], final_byte: u8) {
/* CSI Ps ; Ps final */
}
fn osc_dispatch(&mut self, params: &[&[u8]], bell: bool) { /* OSC */ }
}
let mut parser = Parser::new();
parser.advance(&mut screen, b"\x1b[1;31mhello\x1b[0m");Owned events, replies and terminal state round-trip through a compact,
no_std binary codec:
use vtty_codec::{decode_from_slice, encode_to_vec};
use vtty::{Event, Parser};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Owned events encode/decode as data:
let mut parser = Parser::new();
let events = parser.parse_events(b"\x1b[1;31mhi");
let bytes = encode_to_vec(&events)?;
let restored = decode_from_slice::<Vec<Event>>(&bytes)?;
assert_eq!(events, restored);
Ok(())
}Throughput vs vte/vt100/vtparse/rio-vt — see
crates/vtty_bench for the full table.
cargo test --workspace
cargo test -p vtty --test vt_differential -- --nocapture # parity vs vte
cargo test -p vtty --test vt_differential_rio -- --nocapture # parity vs rio-vtLicensed under either of Apache-2.0 or MIT at your option.