[mdBook]: https://github.com/azerupi/mdBook
-```bash
+```shell
$ cargo install mdbook
```
To build the book:
-```bash
+```shell
$ mdbook build
```
your web browser.
_Firefox:_
-```bash
+```shell
$ firefox book/index.html # Linux
$ open -a "Firefox" book/index.html # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
```
_Chrome:_
-```bash
+```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)
Here’s what’s in `src/main.rs`:
-```
+```rust
fn main() {
println!("Hello, world!");
}
name = "rand"
version = "0.1.0"
source = "git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9"
-
```
You can see that there’s a lot more information here, including the exact
Here’s what’s in `src/main.rs`:
-```
+```rust
fn main() {
println!("Hello, world!");
}
name = "rand"
version = "0.1.0"
source = "git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9"
-
```
You can see that there’s a lot more information here, including the exact
configuration). Any line that starts with `cargo:` is interpreted directly by
Cargo. This line must be of the form `cargo:key=value`, like the examples below:
-```notrust
+```shell
# specially recognized by Cargo
cargo:rustc-link-lib=static=foo
cargo:rustc-link-search=native=/path/to/foo
First, let’s take a look at the directory structure of this package:
-```notrust
+```shell
.
├── Cargo.toml
├── build.rs
Like above, let’s first take a look at the project layout:
-```notrust
+```shell
.
├── Cargo.toml
├── build.rs
Settings](https://crates.io/me) page and run the `cargo login` command
specified.
-```notrust
+```shell
$ cargo login abcdefghijklmnopqrstuvwxyz012345
```
our entire crate and package it all up into a `*.crate` file in the
`target/package` directory.
-```notrust
+```shell
$ cargo package
```
[crates.io] with the `cargo publish` command. And that’s it, you’ve now published
your first crate!
-```notrust
+```shell
$ cargo publish
```
etc.). For situations such as this, Cargo supports a “yank” of a version of a
crate.
-```notrust
+```shell
$ cargo yank --vers 1.0.1
$ cargo yank --vers 1.0.1 --undo
```
may change over time! The owner of a crate is the only person allowed to publish
new versions of the crate, but an owner may designate additional owners.
-```notrust
+```shell
$ cargo owner --add my-buddy
$ cargo owner --remove my-buddy
$ cargo owner --add github:rust-lang:owners
Note that this applies for test binaries as well.
To get the value of any of these variables in a Rust program, do this:
-```
+```rust
let version = env!("CARGO_PKG_VERSION");
```
are not yet set when the build script is compiled, the above example using `env!` won't work
and instead you'll need to retrieve the values when the build script is run:
-```
+```rust
use std::env;
let out_dir = env::var("OUT_DIR").unwrap();
```
In that case, Servo will describe features in its `Cargo.toml` and they can be
enabled using command-line flags:
-```
+```shell
$ cargo build --release --features "shumway pdf"
```
`benches`, which Cargo will treat as containing examples,
integration tests, and benchmarks respectively.
-```notrust
+```shell
▾ src/ # directory containing source files
lib.rs # the main entry point for libraries and packages
main.rs # the main entry point for projects producing executables