Install the Rust toolchain by installing Rustup with the standard and the nightly toolchains.
If you are using a shell capable of running Bash scripts, run the following from the project root directory:
$ ./setup.sh
Otherwise, follow these manual steps:
-
Install Rustfmt.
-
Install Clippy.
-
Install the cargo-deny Cargo plugin.
-
Install the cargo-udeps Cargo plugin.
-
If an installation of the pugins cargo-deny, cargo-udeps fails, you may need to install pkg-config, libssl-dev. For example:
$ sudo apt-get install pkg-config && sudo apt-get install libssl-dev
This project uses Cargo for build automation.
Run from the project root directory:
# | Command | Description |
---|---|---|
0 | cargo deny check && cargo +nightly udeps && cargo +nightly clippy --all-targets --all-features && cargo +nightly fmt --check && cargo +nightly test && cargo +nightly doc --no-deps -Zrustdoc-map |
Analyzes and reports errors, checks style, runs tests. |
0.1 | cargo +nightly fmt |
Reformats the code usingrustfmt . |
0.2 | cargo clean |
Deletes thetarget directory. |
1 | cargo +nightly doc --no-deps -Zrustdoc-map --open |
Generates documentation and opens it in a browser. See https://doc.rust-lang.org/cargo/reference/unstable.html#rustdoc-map . |
1.1 | cargo clean --doc |
Deletes the target/doc directory. |
2 | cargo build |
Builds the project into thetarget/debug directory using the dev Cargo profile. |
3 | (cd ./web-server-from-the-book && exec cargo run) |
Runs web-server-from-the-book , builds the crate if necessary. cargo run -p web-server-from-the-book could have been used alternatively, but it does not change the working directory, which is necessary in this particular case. |