Chapter 1: Tools of the Trade – Rust Toolchains and Project Structures
Rust, as a modern systems programming language, has many inherent characteristics that make it easier to write safe, reliable, and performant code. Rust also has a compiler that enables a relatively fearless code refactoring experience as a project grows in size and complexity. But any programming language in itself is incomplete without the toolchains that support the software development life cycle. After all, where would software engineers be without their tools?
This chapter specifically discusses the Rust toolchain and its ecosystem, and techniques to structure code within Rust projects to write safe, testable, performant, documented, and maintainable code that is also optimized to run in the intended target environment.
The following are the key learning outcomes for this chapter:
- Choosing the right configuration of Rust for your project
- Cargo introduction and project structure
- Cargo build management
- Cargo dependencies
- Writing test scripts and doing automated unit and integration testing
- Automating the generation of technical documentation
By the end of this chapter, you will have learned how to select the right project type and toolchain; organize project code efficiently; add external and internal libraries as dependencies; build the project for development, test, and production environments; automate testing; and generate documentation for your Rust code.