Expand description
§Explanations of ansi-control-codes
This module provides functionality to explain and inspect any ansi-control-code.
Enable this module by using the feature explain
cargo add ansi-control-codes --features explain
§Names of Control Codes
The functions short_name
and long_name
of the trait Explain
provide access to a control function’s name. Short names are the abbreviated names of control functions, whereas
long names are the human readable equivalents.
use ansi_control_codes::categories::format_effectors::CR;
use ansi_control_codes::explain::Explain;
println!("short name: {}, long name: {}", CR.short_name().unwrap(), CR.long_name());
// this will print "short name: CR, long name: Carriage Return"
Short names of control functions are available for all control functions except for private-use control codes.
§Descriptions of Control Codes
The functions short_description
and long_description
of the trait Explain
provide access to a control function’s short and long descriptions. Not all control
functions have long descriptions, in which case the long_description
returns the same description text as the
short_description
functions.
use ansi_control_codes::categories::format_effectors::CR;
use ansi_control_codes::explain::Explain;
println!("short description: {}, long description: {}", CR.short_description(), CR.long_description());
Traits§
- Explain
- Explanation of an ansi-control-code.