Trait vector2math::Trio

source ·
pub trait Trio: Sized {
    type Item;

    fn into_trio(self) -> (Self::Item, Self::Item, Self::Item);
    fn from_items(a: Self::Item, b: Self::Item, c: Self::Item) -> Self;

    fn pairwise<O, T, F, R>(self, other: O, ff: F) -> T
    where
        O: Trio,
        T: Trio<Item = R>,
        F: Fn(Self::Item, O::Item) -> R
, { ... } fn trio_iter(self) -> Chain3<Self::Item> { ... } }
Expand description

Trait for defining a group of 3 items of the same type.

This trait is meant to generalize having three similar things. It is implemented for (T, T, T) and [T; 3] with Item = T. However, because a trio does not necessarily have to be an actual tuple It is also implemented for (T, T, T, T, T, T) and [T; 6] with Item = (T, T, T) and Item = [T; 3] respectively.

Required Associated Types§

The type of the trio’s item

Required Methods§

Get the trio

Create a trio from three items

Provided Methods§

Apply a function pairwise to the items of two trios

Get an iterator over the trio’s items

Implementations on Foreign Types§

Implementors§