pub fn encode_ansi_text(text: &str) -> String {
    text.chars()
        .map(|ch| match ch {
            '\x00' => "\\0".to_string(),
            '\x1B' => "\\e".to_string(),
            '\r' => "\\r".to_string(),
            '\\' => "\\".to_string(),
            _ => ch.to_string(),
        })
        .collect::<Vec<_>>()
        .join("")
}
/// Convert special characters to escaped form
Convert special characters to escaped form
Convert special characters to escaped form
pub fn encode_ansi_text(text: &str) -> String {
    text.chars()
        .map(|ch| match ch {
            '\x00' => "\\0".to_string(),
            '\x1B' => "\\e".to_string(),
            '\r' => "\\r".to_string(),
            '\\' => "\\".to_string(),
            _ => ch.to_string(),
        })
        .collect::<Vec<_>>()
        .join("")
}
pub fn encode_ansi_text ( text : & str ) -> String { text . chars ( ) . map ( | ch | match ch { '\x00' => " \\ " . to_string ( ) , '\x1B' => " \\ " . to_string ( ) , '\r' => " \\ " . to_string ( ) , '\\' => " \\ " . to_string ( ) , _ => ch . to_string ( ) , } ) . collect :: < Vec < _ > > ( ) . join ( " " ) }
Convert special characters to escaped form
Convert special characters to escaped form
text
&str
text
&str