diff --git a/README.md b/README.md index 8643dbb6..d2f59db4 100644 --- a/README.md +++ b/README.md @@ -29,31 +29,31 @@ $ cargo install mdbook ### Building -To build the book, do this: - +The most straight-forward way to build and view the book locally is to use the following command: ```bash -$ mdbook build +$ mdbook serve ``` -The output will be in the `book` subdirectory. To check it out, open it in -your web browser. +This serves the book at http://localhost:3000, and rebuilds it on changes. +You can now view the book in your web browser. If you make changes to the book's source code, +you should only need to refresh your browser to see them. _Firefox:_ ```shell -$ firefox book/index.html # Linux -$ open -a "Firefox" book/index.html # OS X -$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell) -$ start firefox.exe .\book\index.html # Windows (Cmd) +$ firefox http://localhost:3000 # Linux +$ open -a "Firefox" http://localhost:3000 # OS X +$ Start-Process "firefox.exe" http://localhost:3000 # Windows (PowerShell) +$ start firefox.exe http://localhost:3000 # Windows (Cmd) ``` _Chrome:_ ```shell -$ google-chrome book/index.html # Linux -$ open -a "Google Chrome" book/index.html # OS X -$ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell) -$ start chrome.exe .\book\index.html # Windows (Cmd) +$ google-chrome http://localhost:3000 # Linux +$ open -a "Google Chrome" http://localhost:3000 # OS X +$ Start-Process "chrome.exe" http://localhost:3000 # Windows (PowerShell) +$ start chrome.exe http://localhost:3000 # Windows (Cmd) ``` To run the tests: diff --git a/src/editions/transitioning-an-existing-project-to-a-new-edition.md b/src/editions/transitioning-an-existing-project-to-a-new-edition.md index 56782feb..316d99de 100644 --- a/src/editions/transitioning-an-existing-project-to-a-new-edition.md +++ b/src/editions/transitioning-an-existing-project-to-a-new-edition.md @@ -21,7 +21,7 @@ trait Foo { ``` This code uses an anonymous parameter, that `Box`. This is [not -supported in Rust 2018](rust-2018/trait-system/no-anon-params.html), and +supported in Rust 2018](/rust-2018/trait-system/no-anon-params.html), and so this would fail to compile. Let's get this code up to date! ## Updating your code to be compatible with the new edition @@ -89,7 +89,7 @@ trait Foo { ``` In Rust 2018, it's considered idiomatic to use the [`dyn` -keyword](rust-2018/trait-system/dyn-trait-for-trait-objects.html) for +keyword](/rust-2018/trait-system/dyn-trait-for-trait-objects.html) for trait objects. Eventually, we want `cargo fix` to fix all these idioms automatically in the same diff --git a/src/rust-2018/cargo-and-crates-io/index.md b/src/rust-2018/cargo-and-crates-io/index.md index 231c83a3..a59d3fd3 100644 --- a/src/rust-2018/cargo-and-crates-io/index.md +++ b/src/rust-2018/cargo-and-crates-io/index.md @@ -1,6 +1,6 @@ # Cargo and crates.io -[check]: rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html +[check]: /rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html In this chapter of the guide, we discuss a few improvements to `cargo` and crates.io. A notable addition here is the new [`cargo check`][check] command. diff --git a/src/rust-2018/control-flow/index.md b/src/rust-2018/control-flow/index.md index a274d788..2f5e58ba 100644 --- a/src/rust-2018/control-flow/index.md +++ b/src/rust-2018/control-flow/index.md @@ -1,6 +1,6 @@ # Control flow -[async_await]: rust-2018/control-flow/async-await-for-easier-concurrency.html +[async_await]: /rust-2018/control-flow/async-await-for-easier-concurrency.html In this chapter of the guide, we discuss a few improvements to control flow. The most notable of these *will* be [`async` and `await`][async_await]. \ No newline at end of file diff --git a/src/rust-2018/data-types/index.md b/src/rust-2018/data-types/index.md index 369680bd..670713fe 100644 --- a/src/rust-2018/data-types/index.md +++ b/src/rust-2018/data-types/index.md @@ -1,6 +1,6 @@ # Data types -[fis]: rust-2018/data-types/field-init-shorthand.html +[fis]: /rust-2018/data-types/field-init-shorthand.html In this chapter of the guide, we discuss a few improvements to data types. One of these are [field-init-shorthand][fis]. \ No newline at end of file diff --git a/src/rust-2018/documentation/index.md b/src/rust-2018/documentation/index.md index 60726060..607f82fa 100644 --- a/src/rust-2018/documentation/index.md +++ b/src/rust-2018/documentation/index.md @@ -1,6 +1,6 @@ # Documentation -[sec_ed]: rust-2018/documentation/new-editions-of-the-book.html +[sec_ed]: /rust-2018/documentation/new-editions-of-the-book.html In this chapter of the guide, we discuss a few improvements to documentation. A notable addition here is the [second edition of "the book"][sec_ed]. \ No newline at end of file diff --git a/src/rust-2018/error-handling-and-panics/index.md b/src/rust-2018/error-handling-and-panics/index.md index f9792db7..a139a1c6 100644 --- a/src/rust-2018/error-handling-and-panics/index.md +++ b/src/rust-2018/error-handling-and-panics/index.md @@ -1,6 +1,6 @@ # Error handling and Panics -[qop]: rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html +[qop]: /rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html In this chapter of the guide, we discuss a few improvements to error handling in Rust. The most notable of these is [the introduction of the `?` operator][qop]. \ No newline at end of file diff --git a/src/rust-2018/macros/index.md b/src/rust-2018/macros/index.md index 3a37a270..dd66dc0e 100644 --- a/src/rust-2018/macros/index.md +++ b/src/rust-2018/macros/index.md @@ -1,6 +1,6 @@ # Macros -[custom-derive]: rust-2018/macros/custom-derive.html +[custom-derive]: /rust-2018/macros/custom-derive.html In this chapter of the guide, we discuss a few improvements to the macro system. A notable addition here is the introduction of [custom derive macros][custom-derive]. \ No newline at end of file diff --git a/src/rust-2018/module-system/index.md b/src/rust-2018/module-system/index.md index 79a1b66a..ba2405fd 100644 --- a/src/rust-2018/module-system/index.md +++ b/src/rust-2018/module-system/index.md @@ -1,6 +1,6 @@ # Module system -[path clarity changes]: rust-2018/module-system/path-clarity.html +[path clarity changes]: /rust-2018/module-system/path-clarity.html In this chapter of the guide, we discuss a few changes to the module system. The most notable of these are the [path clarity changes]. \ No newline at end of file diff --git a/src/rust-2018/module-system/path-clarity.md b/src/rust-2018/module-system/path-clarity.md index 30075c5b..0f7ad562 100644 --- a/src/rust-2018/module-system/path-clarity.md +++ b/src/rust-2018/module-system/path-clarity.md @@ -93,7 +93,7 @@ Finally, on nightly, you'll need it for crates like: #### Macros One other use for `extern crate` was to import macros; that's no longer needed. -Check [the macro section](rust-2018/macros/macro-changes.html) for more. +Check [the macro section](/rust-2018/macros/macro-changes.html) for more. If you've been using `as` to rename your crate like this: diff --git a/src/rust-2018/ownership-and-lifetimes/index.md b/src/rust-2018/ownership-and-lifetimes/index.md index a8cfb0fa..33ffd615 100644 --- a/src/rust-2018/ownership-and-lifetimes/index.md +++ b/src/rust-2018/ownership-and-lifetimes/index.md @@ -1,6 +1,6 @@ # Ownership and lifetimes -[dmbm]: rust-2018/ownership-and-lifetimes/default-match-bindings.html +[dmbm]: /rust-2018/ownership-and-lifetimes/default-match-bindings.html In this chapter of the guide, we discuss a few improvements to ownership and lifetimes. One of the most notable of these is [default match binding modes][dmbm]. diff --git a/src/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.md b/src/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.md index a3a45ced..b716664e 100644 --- a/src/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.md +++ b/src/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.md @@ -72,4 +72,4 @@ impl Drop for SetOnDrop<'_, T> { } ``` -[the anonymous lifetime]: rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html \ No newline at end of file +[the anonymous lifetime]: /rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html diff --git a/src/rust-2018/platform-and-target-support/index.md b/src/rust-2018/platform-and-target-support/index.md index 2efae82c..f1fcdf39 100644 --- a/src/rust-2018/platform-and-target-support/index.md +++ b/src/rust-2018/platform-and-target-support/index.md @@ -1,6 +1,6 @@ # Platform and target support -[libcore]: rust-2018/platform-and-target-support/libcore-for-low-level-rust.html +[libcore]: /rust-2018/platform-and-target-support/libcore-for-low-level-rust.html In this chapter of the guide, we discuss a few improvements to platform and target support. A notable addition to it was [that the `libcore` library now works on stable Rust][libcore]. \ No newline at end of file diff --git a/src/rust-2018/rustdoc/index.md b/src/rust-2018/rustdoc/index.md index 200fb59c..531d30b5 100644 --- a/src/rust-2018/rustdoc/index.md +++ b/src/rust-2018/rustdoc/index.md @@ -1,6 +1,6 @@ # `rustdoc` -[cf]: rust-2018/rustdoc/documentation-tests-can-now-compile-fail.html +[cf]: /rust-2018/rustdoc/documentation-tests-can-now-compile-fail.html In this chapter of the guide, we discuss a few improvements to `rustdoc`. A notable addition to it was [that documentation tests can now compile-fail][cf]. \ No newline at end of file diff --git a/src/rust-2018/the-compiler/index.md b/src/rust-2018/the-compiler/index.md index fe9b8168..8c735ed1 100644 --- a/src/rust-2018/the-compiler/index.md +++ b/src/rust-2018/the-compiler/index.md @@ -1,6 +1,6 @@ # The compiler -[errors]: rust-2018/the-compiler/improved-error-messages.html +[errors]: /rust-2018/the-compiler/improved-error-messages.html In this chapter of the guide, we discuss a few improvements to the compiler. A notable addition here is our new and [improved error messages][errors]. \ No newline at end of file diff --git a/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md b/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md index c76f0c55..bae89438 100644 --- a/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md +++ b/src/rust-2018/trait-system/dyn-trait-for-trait-objects.md @@ -36,7 +36,7 @@ is sometimes slower, and often cannot be used at all when its alternatives can. Furthermore, with `impl Trait` arriving, "`impl Trait` vs `dyn Trait`" is much more symmetric, and therefore a bit nicer, than "`impl Trait` vs `Trait`". -`impl Trait` is explained [here](rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html) +`impl Trait` is explained [here](/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html) In the new edition, you should therefore prefer `dyn Trait` to just `Trait` where you need a trait object. \ No newline at end of file diff --git a/src/rust-2018/trait-system/index.md b/src/rust-2018/trait-system/index.md index 722506ca..b795d499 100644 --- a/src/rust-2018/trait-system/index.md +++ b/src/rust-2018/trait-system/index.md @@ -1,6 +1,6 @@ # Trait system -[impl_trait]: rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html +[impl_trait]: /rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html In this chapter of the guide, we discuss a few improvements to the trait system. The most notable of these is [`impl Trait`][impl_trait]. \ No newline at end of file