Rust Data StructuresLesson 25Free preview
Rust Tuples
This lesson is part of Rust · All levels
Summary
This study reviews Tuple's data types in Rust that are useful for combining a set of values with different data types into one compound unit. Tuples have a fixed length after being made and their value can be accessed via position index numbers or disassembled through a destructuring process.
Key points
- Tuple can accommodate value-values with heterogeneous data types.
- Declared using the usual parentheses '(value1, value2,...)'
- The element is accessed using point notation followed by the index of numbers: 'tuple.0'
- Supporting pattern matching and destructuring techniques to individual variables
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.