fn list_names_in_archive(fie_name_entries: &[FileNameEntry], legacy_decoder: &dyn IDecoder) {
    use ansi_term::Colour::*;
    use FileNameEncodingType::*;
    lazy_static! {
        static ref REGULAR_UTF8: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Green.bold()).paint("REGULAR UTF-8");
        static ref IRREGULAR_UTF8: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Red.bold()).paint("IRREGULAR UTF-8");
        static ref ASCII_GREEN: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Green.bold()).paint("ASCII");
        static ref GUESSED: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Red.bold()).paint("GUESSED");
    }
    for entry in fie_name_entries {
        match entry.encoding_type {
            ExplicitRegularUTF8 => println!("{}:{}", &*REGULAR_UTF8, &entry.name),
            ExplicitIrregularUTF8 => println!("{}:{}", &*IRREGULAR_UTF8, &entry.name),
            ImplicitASCII => println!("{}:{}", &*ASCII_GREEN, &entry.name),
            ImplicitNonASCII => println!(
                "{} {}:{}",
                prepare_for_non_tty(Red.bold()).paint(legacy_decoder.encoding_name()),
                &*GUESSED,
                &entry.name
            ),
        }
    }
}
/// Decodes and prints file names in central directories to stdout
///
/// # Arguments
///
/// * `cd_entries` - Central directories (contains file names)
/// * `utf8_decoder` - UTF-8 decoder (used when explicitly encoded in UTF-8)
/// * `legacy_decoder` - Legacy charset decoder (used otherwise)
Decodes and prints file names in central directories to stdout
Decodes and prints file names in central directories to stdout
fn list_names_in_archive(fie_name_entries: &[FileNameEntry], legacy_decoder: &dyn IDecoder) {
    use ansi_term::Colour::*;
    use FileNameEncodingType::*;
    lazy_static! {
        static ref REGULAR_UTF8: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Green.bold()).paint("REGULAR UTF-8");
        static ref IRREGULAR_UTF8: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Red.bold()).paint("IRREGULAR UTF-8");
        static ref ASCII_GREEN: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Green.bold()).paint("ASCII");
        static ref GUESSED: ANSIGenericString<'static, str> =
            prepare_for_non_tty(Red.bold()).paint("GUESSED");
    }
    for entry in fie_name_entries {
        match entry.encoding_type {
            ExplicitRegularUTF8 => println!("{}:{}", &*REGULAR_UTF8, &entry.name),
            ExplicitIrregularUTF8 => println!("{}:{}", &*IRREGULAR_UTF8, &entry.name),
            ImplicitASCII => println!("{}:{}", &*ASCII_GREEN, &entry.name),
            ImplicitNonASCII => println!(
                "{} {}:{}",
                prepare_for_non_tty(Red.bold()).paint(legacy_decoder.encoding_name()),
                &*GUESSED,
                &entry.name
            ),
        }
    }
}
fn list_names_in_archive ( fie_name_entries : & [ FileNameEntry ] , legacy_decoder : & dyn IDecoder ) { use ansi_term :: Colour :: * ; use FileNameEncodingType :: * ; lazy_static ! { static ref REGULAR_UTF8 ANSIGenericString ' static str prepare_for_non_tty ( Green bold ( ) ) paint ( " " ) static ref IRREGULAR_UTF8 ANSIGenericString ' static str prepare_for_non_tty ( Red bold ( ) ) paint ( " " ) static ref ASCII_GREEN ANSIGenericString ' static str prepare_for_non_tty ( Green bold ( ) ) paint ( " " ) static ref GUESSED ANSIGenericString ' static str prepare_for_non_tty ( Red bold ( ) ) paint ( " " ) } for entry in fie_name_entries { match entry . encoding_type { ExplicitRegularUTF8 => println ! ( " " REGULAR_UTF8 entry name ) , ExplicitIrregularUTF8 => println ! ( " " IRREGULAR_UTF8 entry name ) , ImplicitASCII => println ! ( " " ASCII_GREEN entry name ) , ImplicitNonASCII => println ! ( " " prepare_for_non_tty ( Red bold ( ) ) paint ( legacy_decoder encoding_name ( ) ) GUESSED entry name ) , } } }
Decodes and prints file names in central directories to stdout
Decodes and prints file names in central directories to stdout
fie_name_entries
&[FileNameEntry]
legacy_decoder
&dyn IDecoder
fie_name_entries
&[FileNameEntry]
legacy_decoder
&dyn IDecoder