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::clear_screen;
use coded_chars::cursor::set_position;
use coded_chars::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

Other :

Modules§

area
Qualify and delimit areas.
characters
This module provides control characters not sorted elsewhere….
control
This module defines the ControlSequence struct which represent sequence introduced by CSI.
cursor
This module helps move and set the cursor position.
delimiters
Various delimiters.
device
Control sequences that are devices-related.
display
This module provides control function that change the display.
editor
Helps edit text.
escape
This module provides escape sequences not sorted elsewhere…
format
These control functions change the format.
introducers
Control sequence and other introducers.
mode
This module helps create the CSI sequences for SM and RM.
presentation
This module provides control function to change the presentation.
shifts
All 7-bits and 8-bits shifts.
transmission
All transmission-related characters.

Functions§

clear_screen
The page is erased and the cursor position is set to the first line and the first column.