Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Rust Web Development with Rocket

You're reading from   Rust Web Development with Rocket A practical guide to starting your journey in Rust web development using the Rocket framework

Arrow left icon
Product type Paperback
Published in Jun 2022
Publisher Packt
ISBN-13 9781800561304
Length 420 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Karuna Murti Karuna Murti
Author Profile Icon Karuna Murti
Karuna Murti
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Part 1: An Introduction to the Rust Programming Language and the Rocket Web Framework
2. Chapter 1: Introducing the Rust Language FREE CHAPTER 3. Chapter 2: Building Our First Rocket Web Application 4. Chapter 3: Rocket Requests and Responses 5. Chapter 4: Building, Igniting, and Launching Rocket 6. Chapter 5: Designing a User-Generated Application 7. Part 2: An In-Depth Look at Rocket Web Application Development
8. Chapter 6: Implementing User CRUD 9. Chapter 7: Handling Errors in Rust and Rocket 10. Chapter 8: Serving Static Assets and Templates 11. Chapter 9: Displaying Users' Post 12. Chapter 10: Uploading and Processing Posts 13. Chapter 11: Securing and Adding an API and JSON 14. Part 3: Finishing the Rust Web Application Development
15. Chapter 12: Testing Your Application 16. Chapter 13: Launching a Rocket Application 17. Chapter 14: Building a Full Stack Application 18. Chapter 15: Improving the Rocket Application 19. Other Books You May Enjoy

Tools and getting help

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.

Tools

Besides Cargo, there are a couple more tools we can use for Rust application development:

  • rustfmt

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.

  • clippy

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.

Text editor

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:

  • The Rust language server

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.

  • Rust analyzer

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.

Getting help and documentation

There are a few important documents that you might want to read to find help or references:

  • The Rust programming language book: This is the book that you want to read if you want to understand more about the Rust programming language. You can find it online at https://doc.rust-lang.org/book/.
  • Rust by Example: This documentation is a collection of small examples that show the concepts of the Rust language and its standard library's capabilities. You can read it online at https://doc.rust-lang.org/rust-by-example/index.html.
  • Standard library documentation: As a programmer, you will refer to this standard library documentation. You can read more about standard libraries, their modules, the function signatures, what standard libraries' functions do, read the examples, and more. Find it at https://doc.rust-lang.org/std/index.html.
  • The Cargo book: If you are interested in Cargo and related information such as the Cargo.toml manifest format, you can read more about it at https://doc.rust-lang.org/cargo/index.html.
  • Rust style guidelines: The Rust language, like other programming languages, has style guidelines. These guidelines tell a programmer what the convention for naming is, about whitespaces, how to use constants, and other idiomatic conventions for a Rust program. Read more about it at https://doc.rust-lang.org/1.0.0/style/.
  • Docs.rs: Suppose you are using a third-party crate, such as the 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 doc: This documentation is not online, but you can install it using 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.
  • The Rust user forum: If you want to get help or help other Rust programmers, you can find it all over the internet. There's a dedicated forum to discuss Rust-related topics at https://users.rust-lang.org/.
You have been reading a chapter from
Rust Web Development with Rocket
Published in: Jun 2022
Publisher: Packt
ISBN-13: 9781800561304
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image