This chapter covers
- Understanding Rust’s string types
- Using Rust’s core data structures
- Applying Rust’s core types effectively
- Converting between data types
- Handling foreign function interface (FFI) compatibility with Rust’s types
Up to this point in the book we haven’t spent much time talking about the Rust language itself. In the previous two chapters we mainly discussed tooling; with that out of the way we can start talking about the language and its features, which we’ll focus on for the rest of this book. In this chapter we’ll cover the most important thing in Rust after basic syntax: data structures.
When working with Rust, you’ll spend a great deal of time interacting with its data structures, as you would any other language. Rust offers most of the features you’d expect from data structures as in any modern programming language, but it does so while offering exceptional safety and performance. Once you get a handle on Rust’s core data types you’ll find the rest of the language comes into great clarity as the patterns often repeat themselves.
We’ll discuss how Rust differs from other languages in its approach to data, review the different data types and structures, and discuss how to effectively use them. We’ll also discuss how Rust’s data types map to C types using the foreign function interface (FFI).