From: Shmuale Mark Date: Thu, 3 Sep 2015 20:24:38 +0000 (-0400) Subject: Fix typoes in part 14. X-Git-Url: https://git.ralfj.de/rust-101.git/commitdiff_plain/30fb994332d6d62ffd199e6e7b45b4a5c84abf83?ds=inline;hp=--cc Fix typoes in part 14. --- 30fb994332d6d62ffd199e6e7b45b4a5c84abf83 diff --git a/src/part14.rs b/src/part14.rs index b2d32f9..3519d43 100644 --- a/src/part14.rs +++ b/src/part14.rs @@ -95,7 +95,7 @@ pub mod rgrep { // We also import some other pieces that we will need. extern crate docopt; use self::docopt::Docopt; - use part12::{run, Options, OutputMode}; + use part13::{run, Options, OutputMode}; use std::process; // The `USAGE` string documents how the program is to be called. It's written in a format that `docopt` can parse. @@ -131,8 +131,8 @@ Options: //@ 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`. + //@ the borrow is valid for the entire program. The bytes pointed to by `pattern`, on the other hand, are owned by someone else, + //@ so we call `to_string` on it to copy the string data into a buffer on the heap owned by a String we own. let mode = if count { OutputMode::Count } else if sort { diff --git a/workspace/src/part14.rs b/workspace/src/part14.rs index fb580f9..5906acf 100644 --- a/workspace/src/part14.rs +++ b/workspace/src/part14.rs @@ -53,7 +53,7 @@ pub mod rgrep { // We also import some other pieces that we will need. extern crate docopt; use self::docopt::Docopt; - use part12::{run, Options, OutputMode}; + use part13::{run, Options, OutputMode}; use std::process; // The `USAGE` string documents how the program is to be called. It's written in a format that `docopt` can parse.