| Crates.io | ansitok |
| lib.rs | ansitok |
| version | 0.3.0 |
| created_at | 2022-07-19 07:48:16.497186+00 |
| updated_at | 2025-01-30 20:44:36.55549+00 |
| description | A library for parsing ANSI Escape Codes |
| homepage | https://gitlab.com/zhiburt/ansitok |
| repository | https://gitlab.com/zhiburt/ansitok |
| max_upload_size | |
| id | 628131 |
| size | 79,825 |
This is a library for parsing ANSI escape sequences.
The list of covered sequences.
let text = "\x1b[31;1;4mHello World\x1b[0m";
for e in parse_ansi(text) {
match e.kind() {
ElementKind::Text => {
println!("Got a text: {:?}", &text[e.range()],);
}
_ => {
println!(
"Got an escape sequence: {:?} from {:#?} to {:#?}",
e.kind(),
e.start(),
e.end()
);
}
}
}
no_std supportno_std is supported via disabling the std feature in your Cargo.toml.
The project got an insiration from https://gitlab.com/davidbittner/ansi-parser.