pub struct UnorderedPair<T>(pub T, pub T);
Expand description

A tuple struct representing an unordered pair

Tuple Fields

0: T1: T

Implementations

Transforms the UnorderedPair<T> into a (T,T). The tuple’s components are always in the same order, smallest to largest.

Examples
use unordered_pair::UnorderedPair;

let pair = UnorderedPair(1,2);
let rev = UnorderedPair(2,1);

let tuple_pair = pair.into_ordered_tuple();
let tuple_rev = rev.into_ordered_tuple();

assert_eq!(tuple_pair, (1,2));
assert_eq!(tuple_rev, (1,2));

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Computes the same hash regardless of the order of the contained items

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Compares two pairs while disregarding the order of the contained items

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.