csi_parser 0.1.3

CSI escape code parser.
Documentation
  • Coverage
  • 35.56%
    16 out of 45 items documented3 out of 15 items with examples
  • Size
  • Source code size: 24.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • YageGeng/csi_parser
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • YageGeng

CSI parser

This is a simple CSI parser that only provides parsing for a subset of common CSI.

This repository was inspired by cansi

If you have additional requirements, feel free to submit a PR (Pull Request)

Please refer to the definition of CSI.

See the rs docs.

Look at progress and contribute on github.

Example

use csi_parser::iter::{CsiParser, Output};

fn main() {
    let text = "👋, \x1b[31;4m🌍\x1b[0m!";

    let result: Vec<Output> = text.csi_parser().skip(1).collect();

    for out in result {
        match out {
            Output::Text(txt) => {
                println!("{}", txt);
            }
            Output::Escape(csi_seq) => {
                println!("{}", csi_seq);
            }
        }
    }
}

and you will be got the result:

[Some(31);None;Some(4)m
🌍
[Some(0);None;Nonem

Features

To support the no_std feature, you simply need to run cargo add --no-default-features -F no_std to your project.