Method implementations for tuples
Tuples are fixed-size collections of elements of different types. They are often used to return multiple values from a function or to group values of different types together.
A single-element tuple is represented as (T,), where T is the type of the element. An empty
tuple () is also known as void.
Methods
impl tuple<Tup> { ... }
Tup: Tuple
- 
fn len(self: &Tup) -> usizeReturns the number of elements in the tuple. Examplelet tuple = (1, 2, 3); assert_eq!(tuple.len(), 3);Run this example
- 
fn equals(lhs: &Tup, rhs: &Tup) -> bool
- 
fn compare(lhs: &Tup, rhs: &Tup) -> Ordering
- 
fn hash<H>(lhs: &Tup, h: &mut H)H: Hasher<H>
Mixins
impl tuple<Tup> { ... }
Tup: Tuple
- 
mixin Equatable<Tup>
- 
Returns falseif arguments are equal,trueotherwise
- 
mixin Comparable<Tup>
- 
Returns trueiflhsis strictly less thanrhs,falseotherwise
- 
Returns trueiflhsis less or equal torhs,falseotherwise
- 
Returns trueiflhsstrictly greater thanrhs,falseotherwise
- 
Returns trueiflhsgreater than or equalrhs,falseotherwise