Crate coded_chars

source ·
Expand description

This crate implements the ECMA-48 standard for coded characters in rust.

Various constructions are provided to easily add control character and sequences inside text.

This crate is compatible with “ANSI terminals”.

§Standard implemented

  • ecma-48 - Control Functions for Coded Character Sets

§An example : format a text printed in an ECMA/ANSI terminal

use coded_chars::control::clear_screen;
use coded_chars::control::cursor::set_position;
use coded_chars::control::presentation::{format_str, select_graphic};

// Direct format
println!("Hello {}World{} !", select_graphic().fg_red().bold().underline(), select_graphic().default());

// Clear screen
clear_screen();

// Using format_str
let formatted = format_str(
    "World",
    select_graphic().fg_red().bold().underline()
 );
println!("Hello {} !", formatted);

set_position(5, 1).exec();
println!("This line is printed on the fifth line.");

§All ECMA-48 control functions

Modules§

  • This module provides all 32 control characters (+ SP).
  • This module provides the CSI sequences.
  • This module provides all escape sequences defined in ecma-48.