pub fn display_list_information(list: &[String], level: u8) {
    eprintln!("Attributes of new list");
    eprintln!("----------------------");
    let list_length = list.len();
    eprintln!("List length               : {}", list_length);
    eprintln!("Mean word length          : {:.2}", mean_word_length(list));
    let shortest_word = list.iter().min_by(|a, b| a.len().cmp(&b.len())).unwrap();
    eprintln!(
        "Length of shortest word   : {} ({})",
        shortest_word.chars().count(),
        shortest_word
    );
    let longest_word = list.iter().max_by(|a, b| a.len().cmp(&b.len())).unwrap();
    eprintln!(
        "Length of longest word    : {} ({})",
        longest_word.chars().count(),
        longest_word
    );
    let free_of_prefix_words = !has_prefix_words(list);
    eprintln!("Free of prefix words      : {}", free_of_prefix_words);

    let entropy_per_word = calc_entropy_per_word(list.len());
    eprintln!("Entropy per word          : {:.4}", entropy_per_word);
    let assumed_entropy_per_letter = assumed_entropy_per_letter(list);
    eprintln!(
        "Assumed entropy per letter: {:.4}",
        assumed_entropy_per_letter
    );
    // If user gets a passphrase consisting entirely of shortest words,
    // it's theoretically possible that we could OVERESTIMATE entropy
    // per word. We can deterimine if we've done this by comparing out
    // entropy estimate against a simple brute force attack, under which
    // we assume each letter adds 4.7 bits of entropy.
    eprintln!(
        "Above brute force line    : {}",
        assumed_entropy_per_letter <= 4.7
    );

    // In 1951, Claude Shannon estimated that English words only have
    // about 2.62 bits of entropy per letter, rather than 4.7 bits per letter.
    // https://www.princeton.edu/~wbialek/rome/refs/shannon_51.pdf
    // Thus, this is a more difficult line for a given list to pass above than
    // the "brute force" line described above.
    eprintln!(
        "Above Shannon line        : {}",
        assumed_entropy_per_letter <= 2.62
    );

    if level >= 2 {
        eprintln!(
            "Shortest edit distance    : {}",
            find_shortest_edit_distance(list)
        );

        let longest_shared_prefix = find_longest_shared_prefix(list);
        eprintln!("Longest shared prefix     : {}", longest_shared_prefix);
        // Numbers of characters required to definitely get to a unique
        // prefix
        eprintln!("Unique character prefix   : {}", longest_shared_prefix + 1);
    }
}
/// This is a large and long function that prints all of the attributes of
/// the generated (new) list.
///
/// We just want to "display" this information, rather than print it to files
/// or stdout, so we use `eprintln!`
This is a large and long function that prints all of the attributes of
the generated (new) list.

We just want to "display" this information, rather than print it to files
or stdout, so we use `eprintln!`
This is a large and long function that prints all of the attributes of the generated ( new ) list . We just want to " display " this information rather than print it to files or stdout so we use ` eprintln! `
pub fn display_list_information(list: &[String], level: u8) {
    eprintln!("Attributes of new list");
    eprintln!("----------------------");
    let list_length = list.len();
    eprintln!("List length               : {}", list_length);
    eprintln!("Mean word length          : {:.2}", mean_word_length(list));
    let shortest_word = list.iter().min_by(|a, b| a.len().cmp(&b.len())).unwrap();
    eprintln!(
        "Length of shortest word   : {} ({})",
        shortest_word.chars().count(),
        shortest_word
    );
    let longest_word = list.iter().max_by(|a, b| a.len().cmp(&b.len())).unwrap();
    eprintln!(
        "Length of longest word    : {} ({})",
        longest_word.chars().count(),
        longest_word
    );
    let free_of_prefix_words = !has_prefix_words(list);
    eprintln!("Free of prefix words      : {}", free_of_prefix_words);
    let entropy_per_word = calc_entropy_per_word(list.len());
    eprintln!("Entropy per word          : {:.4}", entropy_per_word);
    let assumed_entropy_per_letter = assumed_entropy_per_letter(list);
    eprintln!(
        "Assumed entropy per letter: {:.4}",
        assumed_entropy_per_letter
    );
    // If user gets a passphrase consisting entirely of shortest words,
    // it's theoretically possible that we could OVERESTIMATE entropy
    // per word. We can deterimine if we've done this by comparing out
    // entropy estimate against a simple brute force attack, under which
    // we assume each letter adds 4.7 bits of entropy.
    eprintln!(
        "Above brute force line    : {}",
        assumed_entropy_per_letter <= 4.7
    );
    // In 1951, Claude Shannon estimated that English words only have
    // about 2.62 bits of entropy per letter, rather than 4.7 bits per letter.
    // https://www.princeton.edu/~wbialek/rome/refs/shannon_51.pdf
    // Thus, this is a more difficult line for a given list to pass above than
    // the "brute force" line described above.
    eprintln!(
        "Above Shannon line        : {}",
        assumed_entropy_per_letter <= 2.62
    );
    if level >= 2 {
        eprintln!(
            "Shortest edit distance    : {}",
            find_shortest_edit_distance(list)
        );
        let longest_shared_prefix = find_longest_shared_prefix(list);
        eprintln!("Longest shared prefix     : {}", longest_shared_prefix);
        // Numbers of characters required to definitely get to a unique
        // prefix
        eprintln!("Unique character prefix   : {}", longest_shared_prefix + 1);
    }
}
pub fn display_list_information ( list : & [ String ] , level : u8 ) { eprintln ! ( " " ) ; eprintln ! ( " " ) ; let list_length = list . len ( ) ; eprintln ! ( " " list_length ) ; eprintln ! ( " " mean_word_length ( list ) ) ; let shortest_word = list . iter ( ) . min_by ( | a , b | a . len ( ) . cmp ( & b . len ( ) ) ) . unwrap ( ) ; eprintln ! ( " " shortest_word chars ( ) count ( ) shortest_word ) ; let longest_word = list . iter ( ) . max_by ( | a , b | a . len ( ) . cmp ( & b . len ( ) ) ) . unwrap ( ) ; eprintln ! ( " " longest_word chars ( ) count ( ) longest_word ) ; let free_of_prefix_words = ! has_prefix_words ( list ) ; eprintln ! ( " " free_of_prefix_words ) ; let entropy_per_word = calc_entropy_per_word ( list . len ( ) ) ; eprintln ! ( " " entropy_per_word ) ; let assumed_entropy_per_letter = assumed_entropy_per_letter ( list ) ; eprintln ! ( " " assumed_entropy_per_letter ) ; // If user gets a passphrase consisting entirely of shortest words, // it's theoretically possible that we could OVERESTIMATE entropy // per word. We can deterimine if we've done this by comparing out // entropy estimate against a simple brute force attack, under which // we assume each letter adds 4.7 bits of entropy. eprintln ! ( " " assumed_entropy_per_letter 4.7 ) ; // In 1951, Claude Shannon estimated that English words only have // about 2.62 bits of entropy per letter, rather than 4.7 bits per letter. // https://www.princeton.edu/~wbialek/rome/refs/shannon_51.pdf // Thus, this is a more difficult line for a given list to pass above than // the "brute force" line described above. eprintln ! ( " " assumed_entropy_per_letter 2.62 ) ; if level >= 2 { eprintln ! ( " " find_shortest_edit_distance ( list ) ) ; let longest_shared_prefix = find_longest_shared_prefix ( list ) ; eprintln ! ( " " longest_shared_prefix ) ; // Numbers of characters required to definitely get to a unique // prefix eprintln ! ( " " longest_shared_prefix 1 ) ; } }
This is a large and long function that prints all of the attributes of
the generated (new) list.
This is a large and long function that prints all of the attributes of the generated ( new ) list .
list
&[String]
level
u8
list
&[String]
level
u8