Primitive Type tuple
A finite heterogeneous sequence, (T, U, ..)
.
Let’s cover each of those in turn:
Tuples are finite. In other words, a tuple has a length. Here’s a tuple of length 3
:
("hello", 5, 'c');
‘Length’ is also sometimes called ‘arity’ here; each tuple of a different length is a different, distinct type.
Tuples are heterogeneous. This means that each element of the tuple can have a different type. In that tuple above, it has the type:
(&'static str, i32, char)
Tuples are a sequence. This means that they can be accessed by position; this is called ‘tuple indexing’, and it looks like this:
let tuple = ("hello", 5, 'c'); assert_eq!(tuple.0, "hello"); assert_eq!(tuple.1, 5); assert_eq!(tuple.2, 'c');
The sequential nature of the tuple applies to its implementations of various traits. For example, in PartialOrd
and Ord
, the elements are compared sequentially until the first non-equal set is found.
For more about tuples, see the book.
Trait implementations
If every type inside a tuple implements one of the following traits, then a tuple itself also implements it.
Due to a temporary restriction in Rust’s type system, these traits are only implemented on tuples of arity 12 or less. In the future, this may change.
Examples
Basic usage:
let tuple = ("hello", 5, 'c'); assert_eq!(tuple.0, "hello");
Tuples are often used as a return type when you want to return more than one value:
fn calculate_point() -> (i32, i32) { // Don't do a calculation, that's not the point of the example (4, 5) } let point = calculate_point(); assert_eq!(point.0, 4); assert_eq!(point.1, 5); // Combining this with patterns can be nicer. let (x, y) = calculate_point(); assert_eq!(x, 4); assert_eq!(y, 5);
Trait Implementations
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats the value using the given formatter. Read more
pub fn default() -> (A, B, C, D, E, F, G, H, I, J, K, L)
Returns the “default value” for a type. Read more
pub fn default() -> (A, B, C, D, E, F, G, H)
Returns the “default value” for a type. Read more
pub fn default() -> (A, B, C, D, E, F, G, H, I)
Returns the “default value” for a type. Read more
pub fn default() -> (A, B, C, D, E, F, G, H, I, J, K)
Returns the “default value” for a type. Read more
pub fn default() -> (A, B, C, D, E, F, G, H, I, J)
Returns the “default value” for a type. Read more
pub fn extend<T>(&mut self, into_iter: T) where
T: IntoIterator<Item = (A, B)>,
Allows to extend
a tuple of collections that also implement Extend
.
See also: Iterator::unzip
Examples
let mut tuple = (vec![0], vec![1]); tuple.extend([(2, 3), (4, 5), (6, 7)]); assert_eq!(tuple.0, [0, 2, 4, 6]); assert_eq!(tuple.1, [1, 3, 5, 7]); // also allows for arbitrarily nested tuples as elements let mut nested_tuple = (vec![1], (vec![2], vec![3])); nested_tuple.extend([(4, (5, 6)), (7, (8, 9))]); let (a, (b, c)) = nested_tuple; assert_eq!(a, [1, 4, 7]); assert_eq!(b, [2, 5, 8]); assert_eq!(c, [3, 6, 9]);
pub fn extend_one(&mut self, item: (A, B))
Extends a collection with exactly one element.
pub fn extend_reserve(&mut self, additional: usize)
Reserves capacity in a collection for the given number of additional elements. Read more
pub fn cmp(&self, other: &(A,)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G, H)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
pub fn cmp(&self, other: &(A, B, C, D, E, F, G, H, I)) -> Ordering
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
impl<A, B, C, D, E, F, G, H, I, J, K, L> PartialEq<(A, B, C, D, E, F, G, H, I, J, K, L)> for (A, B, C, D, E, F, G, H, I, J, K, L) where
C: PartialEq<C>,
F: PartialEq<F>,
K: PartialEq<K>,
I: PartialEq<I>,
E: PartialEq<E>,
H: PartialEq<H>,
B: PartialEq<B>,
A: PartialEq<A>,
J: PartialEq<J>,
G: PartialEq<G>,
D: PartialEq<D>,
L: PartialEq<L> + ?Sized,
pub fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests for !=
.
impl<A, B, C, D, E, F, G, H, I, J, K> PartialEq<(A, B, C, D, E, F, G, H, I, J, K)> for (A, B, C, D, E, F, G, H, I, J, K) where
C: PartialEq<C>,
F: PartialEq<F>,
K: PartialEq<K> + ?Sized,
I: PartialEq<I>,
E: PartialEq<E>,
H: PartialEq<H>,
B: PartialEq<B>,
A: PartialEq<A>,
J: PartialEq<J>,
G: PartialEq<G>,
D: PartialEq<D>,
pub fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D, E)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D, E)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C, D)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C, D)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B, C)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B, C)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A, B)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A, B)) -> bool
This method tests for !=
.
pub fn eq(&self, other: &(A,)) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
pub fn ne(&self, other: &(A,)) -> bool
This method tests for !=
.
impl<A, B, C, D, E, F, G, H, I, J, K, L> PartialOrd<(A, B, C, D, E, F, G, H, I, J, K, L)> for (A, B, C, D, E, F, G, H, I, J, K, L) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
K: PartialOrd<K> + PartialEq<K>,
I: PartialOrd<I> + PartialEq<I>,
E: PartialOrd<E> + PartialEq<E>,
H: PartialOrd<H> + PartialEq<H>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
J: PartialOrd<J> + PartialEq<J>,
G: PartialOrd<G> + PartialEq<G>,
D: PartialOrd<D> + PartialEq<D>,
L: PartialOrd<L> + PartialEq<L> + ?Sized,
pub fn partial_cmp(
&self,
other: &(A, B, C, D, E, F, G, H, I, J, K, L)
) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K, L)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F, G, H, I, J, K> PartialOrd<(A, B, C, D, E, F, G, H, I, J, K)> for (A, B, C, D, E, F, G, H, I, J, K) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
K: PartialOrd<K> + PartialEq<K> + ?Sized,
I: PartialOrd<I> + PartialEq<I>,
E: PartialOrd<E> + PartialEq<E>,
H: PartialOrd<H> + PartialEq<H>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
J: PartialOrd<J> + PartialEq<J>,
G: PartialOrd<G> + PartialEq<G>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(
&self,
other: &(A, B, C, D, E, F, G, H, I, J, K)
) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J, K)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F, G, H, I, J> PartialOrd<(A, B, C, D, E, F, G, H, I, J)> for (A, B, C, D, E, F, G, H, I, J) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
I: PartialOrd<I> + PartialEq<I>,
E: PartialOrd<E> + PartialEq<E>,
H: PartialOrd<H> + PartialEq<H>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
J: PartialOrd<J> + PartialEq<J> + ?Sized,
G: PartialOrd<G> + PartialEq<G>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(
&self,
other: &(A, B, C, D, E, F, G, H, I, J)
) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G, H, I, J)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F, G, H, I> PartialOrd<(A, B, C, D, E, F, G, H, I)> for (A, B, C, D, E, F, G, H, I) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
I: PartialOrd<I> + PartialEq<I> + ?Sized,
E: PartialOrd<E> + PartialEq<E>,
H: PartialOrd<H> + PartialEq<H>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
G: PartialOrd<G> + PartialEq<G>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(
&self,
other: &(A, B, C, D, E, F, G, H, I)
) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G, H, I)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F, G, H> PartialOrd<(A, B, C, D, E, F, G, H)> for (A, B, C, D, E, F, G, H) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
E: PartialOrd<E> + PartialEq<E>,
H: PartialOrd<H> + PartialEq<H> + ?Sized,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
G: PartialOrd<G> + PartialEq<G>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(&self, other: &(A, B, C, D, E, F, G, H)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G, H)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F, G> PartialOrd<(A, B, C, D, E, F, G)> for (A, B, C, D, E, F, G) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F>,
E: PartialOrd<E> + PartialEq<E>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
G: PartialOrd<G> + PartialEq<G> + ?Sized,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(&self, other: &(A, B, C, D, E, F, G)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F, G)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E, F> PartialOrd<(A, B, C, D, E, F)> for (A, B, C, D, E, F) where
C: PartialOrd<C> + PartialEq<C>,
F: PartialOrd<F> + PartialEq<F> + ?Sized,
E: PartialOrd<E> + PartialEq<E>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(&self, other: &(A, B, C, D, E, F)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E, F)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D, E> PartialOrd<(A, B, C, D, E)> for (A, B, C, D, E) where
C: PartialOrd<C> + PartialEq<C>,
E: PartialOrd<E> + PartialEq<E> + ?Sized,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
D: PartialOrd<D> + PartialEq<D>,
pub fn partial_cmp(&self, other: &(A, B, C, D, E)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D, E)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D, E)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D, E)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D, E)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C, D> PartialOrd<(A, B, C, D)> for (A, B, C, D) where
C: PartialOrd<C> + PartialEq<C>,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
D: PartialOrd<D> + PartialEq<D> + ?Sized,
pub fn partial_cmp(&self, other: &(A, B, C, D)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C, D)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C, D)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C, D)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C, D)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B, C> PartialOrd<(A, B, C)> for (A, B, C) where
C: PartialOrd<C> + PartialEq<C> + ?Sized,
B: PartialOrd<B> + PartialEq<B>,
A: PartialOrd<A> + PartialEq<A>,
pub fn partial_cmp(&self, other: &(A, B, C)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B, C)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B, C)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B, C)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B, C)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A, B> PartialOrd<(A, B)> for (A, B) where
B: PartialOrd<B> + PartialEq<B> + ?Sized,
A: PartialOrd<A> + PartialEq<A>,
pub fn partial_cmp(&self, other: &(A, B)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A, B)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A, B)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A, B)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A, B)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<A> PartialOrd<(A,)> for (A,) where
A: PartialOrd<A> + PartialEq<A> + ?Sized,
pub fn partial_cmp(&self, other: &(A,)) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
pub fn lt(&self, other: &(A,)) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
pub fn le(&self, other: &(A,)) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
pub fn ge(&self, other: &(A,)) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
pub fn gt(&self, other: &(A,)) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn start_bound(&self) -> Bound<&T>
Start index bound. Read more
pub fn end_bound(&self) -> Bound<&T>
End index bound. Read more
fn contains<U>(&self, item: &U) -> bool where
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
Returns true
if item
is contained in the range. Read more
impl<T> RangeBounds<T> for (Bound<T>, Bound<T>)
pub fn start_bound(&self) -> Bound<&T>
Start index bound. Read more
pub fn end_bound(&self) -> Bound<&T>
End index bound. Read more
fn contains<U>(&self, item: &U) -> bool where
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
Returns true
if item
is contained in the range. Read more
impl<T> SliceIndex<[T]> for (Bound<usize>, Bound<usize>)
type Output = [T]
The output type returned by methods.
pub fn get(
self,
slice: &[T]
) -> Option<&<(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output>
slice_index_methods
)Returns a shared reference to the output at this location, if in bounds. Read more
pub fn get_mut(
self,
slice: &mut [T]
) -> Option<&mut <(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output>
slice_index_methods
)Returns a mutable reference to the output at this location, if in bounds. Read more
pub unsafe fn get_unchecked(
self,
slice: *const [T]
) -> *const <(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output
slice_index_methods
)Returns a shared reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index or a dangling slice
pointer is undefined behavior even if the resulting reference is not used. Read more
pub unsafe fn get_unchecked_mut(
self,
slice: *mut [T]
) -> *mut <(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output
slice_index_methods
)Returns a mutable reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index or a dangling slice
pointer is undefined behavior even if the resulting reference is not used. Read more
pub fn index(
self,
slice: &[T]
) -> &<(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output
slice_index_methods
)Returns a shared reference to the output at this location, panicking if out of bounds. Read more
pub fn index_mut(
self,
slice: &mut [T]
) -> &mut <(Bound<usize>, Bound<usize>) as SliceIndex<[T]>>::Output
slice_index_methods
)Returns a mutable reference to the output at this location, panicking if out of bounds. Read more
impl ToSocketAddrs for (IpAddr, u16)
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl ToSocketAddrs for (Ipv4Addr, u16)
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl ToSocketAddrs for (Ipv6Addr, u16)
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl ToSocketAddrs for (&str, u16)
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl ToSocketAddrs for (String, u16)
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved SocketAddr
s. Read more
impl<A, B, C, D, E, F> Eq for (A, B, C, D, E, F) where
C: Eq,
F: Eq + ?Sized,
E: Eq,
B: Eq,
A: Eq,
D: Eq,
impl<A, B, C, D, E, F, G, H, I, J> Eq for (A, B, C, D, E, F, G, H, I, J) where
C: Eq,
F: Eq,
I: Eq,
E: Eq,
H: Eq,
B: Eq,
A: Eq,
J: Eq + ?Sized,
G: Eq,
D: Eq,
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
C: Eq,
F: Eq,
K: Eq,
I: Eq,
E: Eq,
H: Eq,
B: Eq,
A: Eq,
J: Eq,
G: Eq,
D: Eq,
L: Eq + ?Sized,
impl<A, B, C, D, E, F, G, H, I> Eq for (A, B, C, D, E, F, G, H, I) where
C: Eq,
F: Eq,
I: Eq + ?Sized,
E: Eq,
H: Eq,
B: Eq,
A: Eq,
G: Eq,
D: Eq,
impl<A, B, C, D, E, F, G, H> Eq for (A, B, C, D, E, F, G, H) where
C: Eq,
F: Eq,
E: Eq,
H: Eq + ?Sized,
B: Eq,
A: Eq,
G: Eq,
D: Eq,
impl<A, B, C, D, E, F, G> Eq for (A, B, C, D, E, F, G) where
C: Eq,
F: Eq,
E: Eq,
B: Eq,
A: Eq,
G: Eq + ?Sized,
D: Eq,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/primitive.tuple.html