Trait pane::math::Pair

source ·
pub trait Pair {
    type Item;

    fn first(&self) -> Self::Item;
    fn second(&self) -> Self::Item;
    fn from_items(a: Self::Item, b: Self::Item) -> Self;
}
Expand description

A 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.

Required Associated Types

The paired item

Required Methods

Get the first thing

Get the second thing

Create a pair from two items

Implementations on Foreign Types

Implementors