---
source: https://iinventedlight.com/library/notes/rust-tuples.md
title: "Rust tuples: fixed-length groups of mixed types"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (The Rust Programming Language); MIT OR Apache-2.0 (Rust by Example); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Rust Programming Language, Data Types; Rust by Example, tuples. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: rust-tuples"
tags: [rust, tuples, data-types, destructuring]
client: Librarian
sources:
  - id: S1
    title: "Data Types"
    publisher: The Rust Programming Language
    url: https://doc.rust-lang.org/book/ch03-02-data-types.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "tuples"
    publisher: Rust by Example
    url: https://doc.rust-lang.org/rust-by-example/primitives/tuples.html
    accessed: 2026-11-23
    license: "MIT OR Apache-2.0"
---
# Rust tuples: fixed-length groups of mixed types
**Answer:** A tuple groups values with a variety of types into one compound type. Tuples have a fixed length. The tuple without any values has a special name, unit.

## What a tuple is

A tuple groups values with a variety of types into one compound type.

The length is fixed: once you declare a tuple, it cannot grow or shrink in size.

Write a comma-separated list of values inside parentheses; each position may have a different type.

## Destructuring and indexed access

A variable bound to a tuple holds the whole value, because a tuple is considered a single compound element.

In the book's three-element example, destructuring breaks the single tuple into three parts.

We can also access a tuple element with a period followed by its index.

The empty tuple is called unit. Both the value and the type are written ().

## Mixed types and multiple return values

Rust by Example describes a tuple as a collection of values of different types.

Functions can use tuples to return multiple values.

## See also

- [rust-slices](https://iinventedlight.com/library/notes/rust-slices/)
- [rust-structs](https://iinventedlight.com/library/notes/rust-structs/)
- [rust-pattern-syntax](https://iinventedlight.com/library/notes/rust-pattern-syntax/)

## Claims

- id: C1
  claim: A tuple groups values of various types into one compound type.
  source: S1
  evidence: "grouping together a number of values with a variety of types"

- id: C2
  claim: Tuples have a fixed length once declared.
  source: S1
  evidence: "Tuples have a fixed length"

- id: C3
  claim: The first tuple index is 0.
  source: S1
  evidence: "the first index in a tuple is 0"

- id: C4
  claim: The empty tuple is called unit and is written ().
  source: S1
  evidence: "The tuple without any values has a special name, unit"

- id: C5
  claim: A tuple can hold values of different types.
  source: S2
  evidence: "A tuple is a collection of values of different types"

- id: C6
  claim: Functions can return multiple values in a tuple.
  source: S2
  evidence: "Functions can use tuples to return multiple values"

## Sources

- [S1] Data Types. The Rust Programming Language. https://doc.rust-lang.org/book/ch03-02-data-types.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

- [S2] tuples. Rust by Example. https://doc.rust-lang.org/rust-by-example/primitives/tuples.html . License: MIT OR Apache-2.0. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Rust Programming Language, Data Types; Rust by Example, tuples. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/rust-by-example/master/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
