[−][src]Trait vector2math::Pair
Trait for defining a pair of items of the same type.
This trait is meant to generalize having two similar things.
It is implemented for (T, T)
and [T; 2]
with Item = T
.
However, because a pair does not necessarily have to be an
Actual pair It is also implemented for (T, T, T, T)
and
[T; 4]
with Item = (T, T)
and Item = [T; 2]
respectively.
Associated Types
type Item
The type of the pair's item
Required methods
fn first(self) -> Self::Item
Get the first thing
fn second(self) -> Self::Item
Get the second thing
fn from_items(a: Self::Item, b: Self::Item) -> Self
Create a pair from two items
Implementations on Foreign Types
impl<T> Pair for (T, T) where
T: Clone,
[src]
T: Clone,
type Item = T
fn first(self) -> Self::Item
[src]
fn second(self) -> Self::Item
[src]
fn from_items(a: Self::Item, b: Self::Item) -> Self
[src]
impl<T> Pair for [T; 2] where
T: Clone,
[src]
T: Clone,
type Item = T
fn first(self) -> Self::Item
[src]
fn second(self) -> Self::Item
[src]
fn from_items(a: Self::Item, b: Self::Item) -> Self
[src]
impl<T> Pair for (T, T, T, T) where
T: Clone,
[src]
T: Clone,
type Item = (T, T)
fn first(self) -> Self::Item
[src]
fn second(self) -> Self::Item
[src]
fn from_items(a: Self::Item, b: Self::Item) -> Self
[src]
impl<T> Pair for [T; 4] where
T: Clone,
[src]
T: Clone,