Skip to main content

TwoComponent

Trait TwoComponent 

Source
pub trait TwoComponent {
    type Val;

    // Required methods
    fn from_components(c1: Self::Val, c2: Self::Val) -> Self;
    fn to_components(self) -> (Self::Val, Self::Val);
    fn comp1(&self) -> &Self::Val;
    fn comp2(&self) -> &Self::Val;
}
Expand description

Trait that represents types that have two components.

Required Associated Types§

Required Methods§

Source

fn from_components(c1: Self::Val, c2: Self::Val) -> Self

Creates two component value from its components.

Source

fn to_components(self) -> (Self::Val, Self::Val)

Gets the components.

Source

fn comp1(&self) -> &Self::Val

Gets the first of the two components.

Source

fn comp2(&self) -> &Self::Val

Gets the second of the two components.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TwoComponent for (T, T)

Source§

type Val = T

Source§

fn from_components(c1: Self::Val, c2: Self::Val) -> Self

Source§

fn to_components(self) -> (Self::Val, Self::Val)

Source§

fn comp1(&self) -> &Self::Val

Source§

fn comp2(&self) -> &Self::Val

Source§

impl<T> TwoComponent for Range<T>

Source§

type Val = T

Source§

fn from_components(c1: Self::Val, c2: Self::Val) -> Self

Source§

fn to_components(self) -> (Self::Val, Self::Val)

Source§

fn comp1(&self) -> &Self::Val

Source§

fn comp2(&self) -> &Self::Val

Source§

impl<T> TwoComponent for Range<T>

Source§

type Val = T

Source§

fn from_components(c1: Self::Val, c2: Self::Val) -> Self

Source§

fn to_components(self) -> (Self::Val, Self::Val)

Source§

fn comp1(&self) -> &Self::Val

Source§

fn comp2(&self) -> &Self::Val

Implementors§

Source§

impl<T> TwoComponent for Vec2<T>

Source§

type Val = T