Lets Learn Rust - 5 - The Integer Data Type

1 month ago
3

G'day guys

In this video I talk about the integer data type in Rust. I explain both signed an unsigned integers as well as how many bytes each stores, how Rust deals with overflow issues at compile time and much more.

We talk about the following data types specifically:-

- i32 - The default integer type.
- i8
- i16
- i64
- i128
- isize (And how it works for both 32 and 64 bit systems)
- u8
- u16
- u32
- u64
- u128
- usize (Again and how it works for both 32 and 64 bit systems)

Important Times

00:00 - Introduction
01:24 - Declaring and initializing an integer implicitly
03:20 - Understanding how numbers are stored in signed integers
05:36 - Understanding overflow and the compiler
07:24 - Listing all available signed integer types
08:06 - Brief description of the isize type
08:51 - Explanation of unsigned integer types
11:09 - Listing all available unsigned integer types
11:32 - Looking at sizes and number ranges of each integer type
14:27 - Exploring isize and usize on a 32 bit Ubuntu machine
15:47 - When to use each integer type
19:11 - Conclusion

Loading comments...