-
Book Overview & Buying
-
Table Of Contents
The Rust Programming Handbook
By :
Rust provides a rich set of built-in data types that allow you to store and manipulate data efficiently. Understanding these types is essential for effective Rust programming. Rust’s data types can be broadly categorized into scalar types and compound types.
Scalar types represent a single value. Rust’s scalar types include integers, floating-point numbers, Booleans, and characters.
Integers are whole numbers, and Rust provides a variety of types for them, giving you precise control over memory and data representation. Each integer type is defined by its size (the number of bits it uses, such as 8, 16, 32, 64, or 128) and whether it is signed (can be negative, starts with i) or unsigned (only zero and positive, starts with u). For example, an i8 can hold numbers from -128 to 127, while a u8 can hold numbers from 0 to 255. Choosing the appropriate type allows you to optimize memory usage and ensure your variables...