A Rust tuple is a fixed-length sequence whose elements can have different types. Access elements by zero-based position, or destructure them into separate bindings. Tuples are useful for returning multiple values from a function. section 4.5.2
Return values in a tuple
fn swap<A, B>(a: A, b: B) -> (B, A) { (b, a) } let tuple = swap(1, 2); println!("{}, {}", tuple.0, tuple.1); let (first, second) = tuple; section 4.5.2
A match pattern can also destructure a tuple. Unlike arrays, tuples cannot be sliced or iterated over, and their component types cannot be determined at run time. Avoid tuples longer than 12 elements: there is no strict length limit, but the standard library provides trait implementations only up to that size. section 4.5.2
A tuple struct is a distinct form of struct with unnamed, typed fields accessed by position. Omitting field names can be convenient, but may make their meaning ambiguous; use named fields when clarity matters. section 4.5.3














