
Rust Web Development with Rocket
By :

Now that we have created a pretty simple application, you might be wondering what tools we can use for development, and how to find out more about Rust and get help.
Besides Cargo, there are a couple more tools we can use for Rust application development:
This program is for formatting your source code so it follows the Rust style guide. You can install it by using rustup
(rustup component add rustfmt
). Then, you can integrate it with your favorite text editor or use it from the command line. You can read more about rustfmt
at https://github.com/rust-lang/rustfmt.
Does the name remind you of something? clippy
is useful for linting your Cargo application using various lint rules. Right now, there are more than 450 lint rules you can use. You can install it using this command: rustup component add clippy
. Afterward, you can use it in the Cargo application by running cargo clippy
. Can you try it in the Cargo application that we wrote earlier? You can read more about clippy
at https://github.com/rust-lang/rust-clippy.
Most likely, the text editor of your choice already supports the Rust language, or at least syntax highlighting Rust. You can install the Rust language server if you want to add important functionalities such as go to definition, go to implementation, symbol search, and code completion. Most popular text editors already support the language server, so you can just install an extension or other integration method to your text editor:
You can install it using the rustup
command: rustup component add rls rust-analysis rust-src
. Then, you can integrate it into your text editor. For example, if you are using Visual Studio Code, you can install the Rust extension and enable rls
.
You can read more about it at https://github.com/rust-lang/rls.
This application is poised to be the Rust language server 2.0. It's still considered to be in alpha as of the writing of this book, but in my experience, this application works well with regular updates. You can find the executable for this one at https://github.com/rust-analyzer/rust-analyzer/releases, and then configure your editor language server to use this application. You can read more about it at https://rust-analyzer.github.io.
There are a few important documents that you might want to read to find help or references:
Cargo.toml
manifest format, you can read more about it at https://doc.rust-lang.org/cargo/index.html.rsa
crate that we used earlier. To find documentation for that library, you can go to https://crates.io and search for the crate's page, then go to the right pane and go to the documentation section. Or, you can go to https://docs.rs and search for the crate name and find the documentation for it.rustup
(rustup component add rust-docs
). Then, you can open documentation in your browser while offline using the rustup doc
command. If you want to open standard library documentation offline, you can type rustup doc --std
. There are other documents you can open; try and see what they are by using rustup doc --help
.