Primitive Type tuple
[-] [+]
Operations on tuples
To access a single element of a tuple one can use the following methods:
valN
- returns a value of N-th elementrefN
- returns a reference to N-th elementmutN
- returns a mutable reference to N-th element
Indexing starts from zero, so val0
returns first value, val1
returns second value, and so on. In general, a tuple with S
elements provides aforementioned methods suffixed with numbers
from 0
to S-1
. Traits which contain these methods are
implemented for tuples with up to 12 elements.
If every type inside a tuple implements one of the following traits, then a tuple itself also implements it.
Clone
PartialEq
Eq
PartialOrd
Ord
Default