- //@ If you check all the type carefully, you will notice that `pattern` above if of type `&str`. `str` is the type of a UTF-8 encoded string, that is, a bunch of
- //@ bytes in memory (`[u8]`) that are valid according of UTF-8. `str` is unsized. `&str` is a sliced string, and stores the address of the character data, and
- //@ their length. String literals like "this one" are of type `&'static str`: They point right to the constant section of the binary, you you cannot claim you
- //@ own them. However, the borrow is valid for as long as the program runs, hence it has lifetime `'static`. Calling `to_string` will copy the string data
- //@ into an owned buffer on the heap, and thus convert it to `String`.
+ //@ If you check all the types carefully, you will notice that `pattern` above is of type `&str`. `str` is the type of a UTF-8
+ //@ encoded string, that is, a bunch of bytes in memory (`[u8]`) that are valid according of UTF-8. `str` is unsized. `&str`
+ //@ stores the address of the character data, and their length. String literals like "this one" are
+ //@ of type `&'static str`: They point right to the constant section of the binary, so
+ //@ However, the borrow is valid for as long as the program runs, hence it has lifetime `'static`. Calling
+ //@ `to_string` will copy the string data into an owned buffer on the heap, and thus convert it to `String`.
+ let mode = if count {
+ OutputMode::Count
+ } else if sort {
+ OutputMode::SortAndPrint
+ } else {
+ OutputMode::Print
+ };