O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Types

Rust's type system borrows a lot from the functional world with its structured types and traits. The type system is very strong: the types do not change under the hood and when something expects type X, you need to give it type X. Furthermore, the type system is static; nearly all of the type checks are done at runtime. These features give you very robust programs that rarely do the wrong thing during runtime, with the cost that writing the programs becomes a bit more constrained.

Rust's whole type system is not small, and we'll try to take a deep dive into it here. Expect lots of heavy material in this chapter, and be brave!

In this chapter, we will cover the following topics:

  • String types
  • Arrays and slices
  • Generic types
  • Traits and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required