A finite heterogeneous sequence, (T, U, ..).
To access the N-th element of a tuple one can use N itself
as a field of the tuple.
Indexing starts from zero, so 0 returns first value, 1
returns second value, and so on. In general, a tuple with S
elements provides aforementioned fields from 0 to S-1.
If every type inside a tuple implements one of the following
traits, then a tuple itself also implements it.
Clone
PartialEq
Eq
PartialOrd
Ord
Debug
Default
Hash
Accessing elements of a tuple at specified indices:
fn main() {
let x = ("colorless", "green", "ideas", "sleep", "furiously");
assert_eq!(x.3, "sleep");
let v = (3, 3);
let u = (1, -5);
assert_eq!(v.0 * u.0 + v.1 * u.1, -12);
}
let x = ("colorless", "green", "ideas", "sleep", "furiously");
assert_eq!(x.3, "sleep");
let v = (3, 3);
let u = (1, -5);
assert_eq!(v.0 * u.0 + v.1 * u.1, -12);
Using traits implemented for tuples:
fn main() {
let a = (1, 2);
let b = (3, 4);
assert!(a != b);
let c = b.clone();
assert!(b == c);
let d : (u32, f32) = Default::default();
assert_eq!(d, (0, 0.0f32));
}
let a = (1, 2);
let b = (3, 4);
assert!(a != b);
let c = b.clone();
assert!(b == c);
let d : (u32, f32) = Default::default();
assert_eq!(d, (0, 0.0f32));
Trait Implementations
impl Eq for ()
fn lt(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
fn gt(&self, other: &Rhs) -> bool
fn ge(&self, other: &Rhs) -> bool
impl<A> Hash for (A) where A: Hash
impl<A, B> Hash for (A, B) where A: Hash, B: Hash
impl<A, B, C> Hash for (A, B, C) where C: Hash, B: Hash, A: Hash
impl<A, B, C, D> Hash for (A, B, C, D) where A: Hash, D: Hash, B: Hash, C: Hash
impl<A, B, C, D, E> Hash for (A, B, C, D, E) where D: Hash, E: Hash, B: Hash, C: Hash, A: Hash
impl<A, B, C, D, E, F> Hash for (A, B, C, D, E, F) where B: Hash, D: Hash, C: Hash, A: Hash, F: Hash, E: Hash
impl<A, B, C, D, E, F, G> Hash for (A, B, C, D, E, F, G) where C: Hash, D: Hash, F: Hash, B: Hash, G: Hash, E: Hash, A: Hash
impl<A, B, C, D, E, F, G, H> Hash for (A, B, C, D, E, F, G, H) where G: Hash, E: Hash, F: Hash, A: Hash, D: Hash, C: Hash, B: Hash, H: Hash
impl<A, B, C, D, E, F, G, H, I> Hash for (A, B, C, D, E, F, G, H, I) where F: Hash, E: Hash, G: Hash, H: Hash, C: Hash, I: Hash, D: Hash, B: Hash, A: Hash
impl<A, B, C, D, E, F, G, H, I, J> Hash for (A, B, C, D, E, F, G, H, I, J) where B: Hash, I: Hash, C: Hash, J: Hash, F: Hash, A: Hash, H: Hash, E: Hash, D: Hash, G: Hash
impl<A, B, C, D, E, F, G, H, I, J, K> Hash for (A, B, C, D, E, F, G, H, I, J, K) where C: Hash, J: Hash, D: Hash, E: Hash, A: Hash, G: Hash, B: Hash, K: Hash, I: Hash, H: Hash, F: Hash
impl<A, B, C, D, E, F, G, H, I, J, K, L> Hash for (A, B, C, D, E, F, G, H, I, J, K, L) where L: Hash, E: Hash, D: Hash, G: Hash, F: Hash, C: Hash, H: Hash, A: Hash, I: Hash, K: Hash, J: Hash, B: Hash
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T0: Debug, T5: Debug, T9: Debug, T1: Debug, T4: Debug, T6: Debug, T7: Debug, T11: Debug, T8: Debug, T3: Debug, T2: Debug, T10: Debug
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T7: Debug, T8: Debug, T10: Debug, T11: Debug, T3: Debug, T2: Debug, T5: Debug, T6: Debug, T4: Debug, T1: Debug, T9: Debug
impl<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where T3: Debug, T2: Debug, T5: Debug, T7: Debug, T9: Debug, T10: Debug, T6: Debug, T11: Debug, T4: Debug, T8: Debug
impl<T3, T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T3, T4, T5, T6, T7, T8, T9, T10, T11) where T10: Debug, T7: Debug, T8: Debug, T3: Debug, T9: Debug, T4: Debug, T6: Debug, T11: Debug, T5: Debug
impl<T4, T5, T6, T7, T8, T9, T10, T11> Debug for (T4, T5, T6, T7, T8, T9, T10, T11) where T11: Debug, T4: Debug, T6: Debug, T9: Debug, T10: Debug, T5: Debug, T7: Debug, T8: Debug
impl<T5, T6, T7, T8, T9, T10, T11> Debug for (T5, T6, T7, T8, T9, T10, T11) where T6: Debug, T7: Debug, T10: Debug, T8: Debug, T9: Debug, T5: Debug, T11: Debug
impl<T6, T7, T8, T9, T10, T11> Debug for (T6, T7, T8, T9, T10, T11) where T11: Debug, T8: Debug, T6: Debug, T10: Debug, T9: Debug, T7: Debug
impl<T7, T8, T9, T10, T11> Debug for (T7, T8, T9, T10, T11) where T9: Debug, T8: Debug, T7: Debug, T11: Debug, T10: Debug
impl<T8, T9, T10, T11> Debug for (T8, T9, T10, T11) where T9: Debug, T11: Debug, T8: Debug, T10: Debug
impl<T9, T10, T11> Debug for (T9, T10, T11) where T11: Debug, T9: Debug, T10: Debug
impl<T10, T11> Debug for (T10, T11) where T11: Debug, T10: Debug
impl<T11> Debug for (T11) where T11: Debug
impl<A> Eq for (A) where A: Eq
impl<A> Ord for (A) where A: Ord
impl<A, B> Clone for (A, B) where B: Clone, A: Clone
impl<A, B> Eq for (A, B) where A: Eq, B: Eq
impl<A, B> Ord for (A, B) where B: Ord, A: Ord
impl<A, B, C> Clone for (A, B, C) where C: Clone, A: Clone, B: Clone
impl<A, B, C> Eq for (A, B, C) where B: Eq, A: Eq, C: Eq
fn lt(&self, other: &(A, B, C)) -> bool
fn le(&self, other: &(A, B, C)) -> bool
fn ge(&self, other: &(A, B, C)) -> bool
fn gt(&self, other: &(A, B, C)) -> bool
impl<A, B, C> Ord for (A, B, C) where A: Ord, B: Ord, C: Ord
impl<A, B, C, D> Clone for (A, B, C, D) where C: Clone, A: Clone, D: Clone, B: Clone
fn eq(&self, other: &(A, B, C, D)) -> bool
fn ne(&self, other: &(A, B, C, D)) -> bool
impl<A, B, C, D> Eq for (A, B, C, D) where C: Eq, B: Eq, A: Eq, D: Eq
fn lt(&self, other: &(A, B, C, D)) -> bool
fn le(&self, other: &(A, B, C, D)) -> bool
fn ge(&self, other: &(A, B, C, D)) -> bool
fn gt(&self, other: &(A, B, C, D)) -> bool
impl<A, B, C, D> Ord for (A, B, C, D) where A: Ord, C: Ord, D: Ord, B: Ord
impl<A, B, C, D, E> Clone for (A, B, C, D, E) where A: Clone, D: Clone, B: Clone, E: Clone, C: Clone
fn eq(&self, other: &(A, B, C, D, E)) -> bool
fn ne(&self, other: &(A, B, C, D, E)) -> bool
impl<A, B, C, D, E> Eq for (A, B, C, D, E) where B: Eq, A: Eq, C: Eq, D: Eq, E: Eq
fn lt(&self, other: &(A, B, C, D, E)) -> bool
fn le(&self, other: &(A, B, C, D, E)) -> bool
fn ge(&self, other: &(A, B, C, D, E)) -> bool
fn gt(&self, other: &(A, B, C, D, E)) -> bool
impl<A, B, C, D, E> Ord for (A, B, C, D, E) where B: Ord, D: Ord, C: Ord, A: Ord, E: Ord
impl<A, B, C, D, E, F> Clone for (A, B, C, D, E, F) where B: Clone, E: Clone, D: Clone, F: Clone, A: Clone, C: Clone
fn eq(&self, other: &(A, B, C, D, E, F)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F)) -> bool
impl<A, B, C, D, E, F> Eq for (A, B, C, D, E, F) where F: Eq, E: Eq, B: Eq, A: Eq, C: Eq, D: Eq
fn lt(&self, other: &(A, B, C, D, E, F)) -> bool
fn le(&self, other: &(A, B, C, D, E, F)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F)) -> bool
impl<A, B, C, D, E, F> Ord for (A, B, C, D, E, F) where F: Ord, C: Ord, A: Ord, E: Ord, B: Ord, D: Ord
impl<A, B, C, D, E, F, G> Clone for (A, B, C, D, E, F, G) where G: Clone, B: Clone, A: Clone, C: Clone, E: Clone, D: Clone, F: Clone
fn eq(&self, other: &(A, B, C, D, E, F, G)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G)) -> bool
impl<A, B, C, D, E, F, G> Eq for (A, B, C, D, E, F, G) where F: Eq, A: Eq, E: Eq, D: Eq, B: Eq, C: Eq, G: Eq
fn lt(&self, other: &(A, B, C, D, E, F, G)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G)) -> bool
impl<A, B, C, D, E, F, G> Ord for (A, B, C, D, E, F, G) where C: Ord, B: Ord, G: Ord, A: Ord, F: Ord, E: Ord, D: Ord
impl<A, B, C, D, E, F, G, H> Clone for (A, B, C, D, E, F, G, H) where B: Clone, H: Clone, C: Clone, D: Clone, G: Clone, E: Clone, F: Clone, A: Clone
fn eq(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
impl<A, B, C, D, E, F, G, H> Eq for (A, B, C, D, E, F, G, H) where C: Eq, B: Eq, F: Eq, E: Eq, D: Eq, A: Eq, H: Eq, G: Eq
fn lt(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
impl<A, B, C, D, E, F, G, H> Ord for (A, B, C, D, E, F, G, H) where E: Ord, B: Ord, D: Ord, G: Ord, C: Ord, H: Ord, A: Ord, F: Ord
impl<A, B, C, D, E, F, G, H, I> Clone for (A, B, C, D, E, F, G, H, I) where H: Clone, C: Clone, I: Clone, D: Clone, A: Clone, G: Clone, E: Clone, F: Clone, B: Clone
fn clone(&self) -> (A, B, C, D, E, F, G, H, I)
fn clone_from(&mut self, source: &Self)
fn eq(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
impl<A, B, C, D, E, F, G, H, I> Eq for (A, B, C, D, E, F, G, H, I) where H: Eq, G: Eq, I: Eq, C: Eq, A: Eq, D: Eq, F: Eq, E: Eq, B: Eq
fn lt(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
impl<A, B, C, D, E, F, G, H, I> Ord for (A, B, C, D, E, F, G, H, I) where I: Ord, B: Ord, D: Ord, F: Ord, C: Ord, G: Ord, H: Ord, E: Ord, A: Ord
impl<A, B, C, D, E, F, G, H, I, J> Clone for (A, B, C, D, E, F, G, H, I, J) where E: Clone, H: Clone, I: Clone, B: Clone, G: Clone, A: Clone, F: Clone, D: Clone, C: Clone, J: Clone
fn clone(&self) -> (A, B, C, D, E, F, G, H, I, J)
fn clone_from(&mut self, source: &Self)
fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
impl<A, B, C, D, E, F, G, H, I, J> Eq for (A, B, C, D, E, F, G, H, I, J) where E: Eq, H: Eq, A: Eq, C: Eq, J: Eq, B: Eq, D: Eq, F: Eq, G: Eq, I: Eq
fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
impl<A, B, C, D, E, F, G, H, I, J> Ord for (A, B, C, D, E, F, G, H, I, J) where B: Ord, D: Ord, H: Ord, E: Ord, C: Ord, I: Ord, A: Ord, G: Ord, J: Ord, F: Ord
fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> Ordering
fn default() -> (A, B, C, D, E, F, G, H, I, J)
impl<A, B, C, D, E, F, G, H, I, J, K> Clone for (A, B, C, D, E, F, G, H, I, J, K) where A: Clone, H: Clone, K: Clone, E: Clone, G: Clone, J: Clone, B: Clone, D: Clone, C: Clone, I: Clone, F: Clone
fn clone(&self) -> (A, B, C, D, E, F, G, H, I, J, K)
fn clone_from(&mut self, source: &Self)
fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
impl<A, B, C, D, E, F, G, H, I, J, K> Eq for (A, B, C, D, E, F, G, H, I, J, K) where D: Eq, I: Eq, C: Eq, E: Eq, F: Eq, A: Eq, G: Eq, H: Eq, K: Eq, J: Eq, B: Eq
fn partial_cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> Option<Ordering>
fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
impl<A, B, C, D, E, F, G, H, I, J, K> Ord for (A, B, C, D, E, F, G, H, I, J, K) where F: Ord, C: Ord, D: Ord, B: Ord, G: Ord, K: Ord, E: Ord, H: Ord, J: Ord, A: Ord, I: Ord
fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> Ordering
fn default() -> (A, B, C, D, E, F, G, H, I, J, K)
impl<A, B, C, D, E, F, G, H, I, J, K, L> Clone for (A, B, C, D, E, F, G, H, I, J, K, L) where E: Clone, H: Clone, C: Clone, A: Clone, I: Clone, G: Clone, D: Clone, L: Clone, F: Clone, J: Clone, B: Clone, K: Clone
fn clone(&self) -> (A, B, C, D, E, F, G, H, I, J, K, L)
fn clone_from(&mut self, source: &Self)
fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
impl<A, B, C, D, E, F, G, H, I, J, K, L> Eq for (A, B, C, D, E, F, G, H, I, J, K, L) where G: Eq, C: Eq, I: Eq, E: Eq, K: Eq, A: Eq, L: Eq, B: Eq, D: Eq, F: Eq, J: Eq, H: Eq
fn partial_cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> Option<Ordering>
fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
impl<A, B, C, D, E, F, G, H, I, J, K, L> Ord for (A, B, C, D, E, F, G, H, I, J, K, L) where H: Ord, E: Ord, A: Ord, F: Ord, K: Ord, G: Ord, C: Ord, D: Ord, I: Ord, B: Ord, J: Ord, L: Ord
fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> Ordering
fn default() -> (A, B, C, D, E, F, G, H, I, J, K, L)