Module std::tuple

Overview

The Tuple fixed collection.

Tuples are anonymous types that can hold a fixed number of elements.

Tuples in Rune are declared with the special (a) syntax, but can also be interacted with through the fundamental Tuple type.

Once a tuple has been declared, its size cannot change.

The tuple type has support for native pattern matching:

let value = (1, 2);

if let (a, b) = value {
   assert_eq!(a, 1);
   assert_eq!(b, 2);
}

Examples

let empty = ();
let one = (10,);
let two = (10, 20);

assert!(empty.is_empty());
assert_eq!(one.0, 10);
assert_eq!(two.0, 10);
assert_eq!(two.1, 20);

Structs

Tuple

The tuple type.