Skip to main content

Crate uord

Crate uord 

Source
Expand description

A library providing implementations of unordered pairs (or more generally, unordered sets).

This is useful when, for example, you want to create a HashMap that associates data with pairs of things:

let mut map: HashMap<UOrd2<u16>, String> = HashMap::new();
map.insert(UOrd2::new([1, 6]), "1-6".to_owned());
map.insert(UOrd2::new([3, 5]), "3-5".to_owned());
map.insert(UOrd2::new([2, 4]), "2-4".to_owned());

assert!(map.contains_key(&UOrd2::new([1, 6])));

When creating a UOrd, the ordering of the items on creation does not matter, and UOrds created with different initial element orders will be equal to one another.

Modules§

proxy
Structs and traits through which you can customize the implementations of Ord and PartialEq used for types in UOrd.

Structs§

UOrd
An unordered tuple of items of type T and length N.
UOrdIntoIter
An iterator over each element of a UOrd.
UOrdIter
An iterator over references to each element of a UOrd.
UOrdProxiedIntoIter
An iterator over each element of a UOrdProxied, stripped of their wrappers.
UOrdProxiedIter
An iterator over references to each element of a UOrdProxied, stripped of their wrappers.

Type Aliases§

UOrd2
An unordered tuple of items of type T and length 2.
UOrd3
An unordered tuple of items of type T and length 3.
UOrd4
An unordered tuple of items of type T and length 4.
UOrd5
An unordered tuple of items of type T and length 5.
UOrd6
An unordered tuple of items of type T and length 6.
UOrdProxied
An unordered tuple of items of type T and length N, additionally utilizing a Proxy.
UOrdProxied2
An unordered tuple of items of type T and length 2, additionally utilizing a Proxy.
UOrdProxied3
An unordered tuple of items of type T and length 3, additionally utilizing a Proxy.
UOrdProxied4
An unordered tuple of items of type T and length 4, additionally utilizing a Proxy.
UOrdProxied5
An unordered tuple of items of type T and length 5, additionally utilizing a Proxy.
UOrdProxied6
An unordered tuple of items of type T and length 6, additionally utilizing a Proxy.