Rust Programming Cookbook
上QQ阅读APP看书,第一时间看更新

Creating and using data types

Rust features all of the basic types: signed and unsigned integers up to 64 bits in width; floating-point types up to 64 bits; character types; and Booleans. Of course, any program will need more complex data structures to remain readable.

If you are unfamiliar with unit tests in Rust (or in general), we suggest going through the Writing tests and benchmarks recipe here in this chapter  first.

In this recipe, we'll look at good basic practices to create and use data types.