Compare commits
No commits in common. "6b81631b85da05fbacb65f205a5d38cbed4737c2" and "c285678d26732a90c7fa8bc74480673082cfc44f" have entirely different histories.
6b81631b85
...
c285678d26
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "ansi"
|
||||
description = "This library contains all ANSI Escape Codes that are defined in the ISO 6429 Standard"
|
||||
version = "0.0.1"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
authors = ["Frank Zechert <rust.frank@zechert.net>"]
|
||||
@ -9,9 +9,8 @@ repository = "https://git.zechert.net/fzechert/ansi.git"
|
||||
license = "MIT"
|
||||
|
||||
# crates.io
|
||||
publish = true
|
||||
publish = false
|
||||
keywords = ["ansi", "escape codes", "ISO 6429", "ECMA 48", "ANSI X3.64"]
|
||||
categories = ["command-line-interface"]
|
||||
include = ["**/*.rs", "Cargo.toml"]
|
||||
|
||||
[dependencies]
|
||||
|
18
src/lib.rs
18
src/lib.rs
@ -65,6 +65,7 @@
|
||||
//! [ecma-48]: https://www.ecma-international.org/publications-and-standards/standards/ecma-48/
|
||||
//! [iso-6429]: https://www.iso.org/standard/12782.html
|
||||
//! [wikipedia-ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::{fmt, str};
|
||||
|
||||
@ -138,6 +139,15 @@ enum ControlFunctionType {
|
||||
///
|
||||
/// The independent control functions are defined in the module [independent_control_functions].
|
||||
IndependentControlFunction,
|
||||
|
||||
/// Control Strings.
|
||||
///
|
||||
/// A control string is a string of bit combinations which may occur in the data stream as a logical entity for
|
||||
/// control purposes. A control string consists of an opening delimiter, a command string or character string, and
|
||||
/// a terminating delimiter, the String Terminator ([`ST`][c1::ST]).
|
||||
///
|
||||
/// The control strings are defined in the module [control_strings].
|
||||
ControlString,
|
||||
}
|
||||
|
||||
impl fmt::Debug for ControlFunctionType {
|
||||
@ -149,6 +159,7 @@ impl fmt::Debug for ControlFunctionType {
|
||||
ControlFunctionType::IndependentControlFunction => {
|
||||
write!(f, "Independent Control Function")
|
||||
}
|
||||
ControlFunctionType::ControlString => write!(f, "Control String"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,6 +241,9 @@ impl fmt::Display for ControlFunction {
|
||||
ControlFunctionType::IndependentControlFunction => {
|
||||
write!(f, "{}{}", c0::ESC, self.value)
|
||||
}
|
||||
ControlFunctionType::ControlString => {
|
||||
write!(f, "{}", self.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,6 +296,10 @@ mod tests {
|
||||
format!("{:?}", ControlFunctionType::IndependentControlFunction),
|
||||
"Independent Control Function"
|
||||
);
|
||||
assert_eq!(
|
||||
format!("{:?}", ControlFunctionType::ControlString),
|
||||
"Control String"
|
||||
);
|
||||
}
|
||||
|
||||
/// Test the debug format of [`ControlFunction`][crate::ControlFunction].
|
||||
|
Loading…
x
Reference in New Issue
Block a user