Merge pull request #3 from nelsonjchen/typo_fix
[rust-101.git] / src / part14.rs
index 189a9060f8bf7fd195fb31409077a7a5dec1048a..45044afe48fc9dd513816e9b37e7e94f470fd547 100644 (file)
@@ -69,7 +69,7 @@ fn sort_array() {
 
 // ## External Dependencies
 //@ This leaves us with just one more piece to complete rgrep: Taking arguments from the command-line. We could now directly work on
-//@ [`std::env::args`](http://doc.rust-lang.org/stable/std/env/fn.args.html) to gain access to those arguments, and this would become
+//@ [`std::env::args`](https://doc.rust-lang.org/stable/std/env/fn.args.html) to gain access to those arguments, and this would become
 //@ a pretty boring lesson in string manipulation. Instead, I want to use this opportunity to show how easy it is to benefit from
 //@ other people's work in your program.
 //@ 
@@ -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, 
+        //@ and we call `to_string` on it to copy the string data into a buffer on the heap that we own.
         let mode = if count {
             OutputMode::Count
         } else if sort {
@@ -159,4 +159,4 @@ Options:
 // the pattern to regular-expression mode, and change `filter_lines` to honor this option. The documentation of regex is available from its crates.io site.
 // (You won't be able to use the `regex!` macro if you are on the stable or beta channel of Rust. But it wouldn't help for our use-case anyway.)
 
-//@ [index](main.html) | [previous](part13.html) | [next](part15.html)
+//@ [index](main.html) | [previous](part13.html) | [raw source](https://www.ralfj.de/git/rust-101.git/blob_plain/HEAD:/workspace/src/part14.rs) | [next](part15.html)