Trait dialectic::types::Select[][src]

pub trait Select<N: Unary>: Select<N> {
    type Selected;
    type Remainder;
}

Select by index from a type level list.

This is used internally by the Choose, Offer, and Continue session types.

Examples

use static_assertions::{assert_impl_all, assert_not_impl_any};
use dialectic::types::*;
use dialectic::unary::UnaryOf;

type L = (UnaryOf<0>, (UnaryOf<1>, (UnaryOf<2>, ())));

assert_impl_all!(L: Select<UnaryOf<0>, Selected = UnaryOf<0>, Remainder = (UnaryOf<1>, (UnaryOf<2>, ()))>);
assert_impl_all!(L: Select<UnaryOf<1>, Selected = UnaryOf<1>, Remainder = (UnaryOf<0>, (UnaryOf<2>, ()))>);
assert_impl_all!(L: Select<UnaryOf<2>, Selected = UnaryOf<2>, Remainder = (UnaryOf<0>, (UnaryOf<1>, ()))>);

assert_not_impl_any!(L: Select<UnaryOf<3>>);

Associated Types

type Selected[src]

The thing which is selected from this list by the index N.

type Remainder[src]

The list with the selected thing removed.

Loading content...

Implementations on Foreign Types

impl<T, Rest> Select<Z> for (T, Rest)[src]

type Selected = T

type Remainder = Rest

impl<T, P, Rest, N: Unary> Select<S<N>> for (T, (P, Rest)) where
    (P, Rest): Select<N>, 
[src]

type Selected = <(P, Rest) as Select<N>>::Selected

type Remainder = (T, <(P, Rest) as Select<N>>::Remainder)

Loading content...

Implementors

Loading content...