tuple 0.1.4

Element-wise operations on tuples
#![feature(prelude_import)]
#![no_std]
/*!
# Examples

```
extern crate tuple;
use tuple::*;
# fn main() {
let a = T2(3, 4) + T2(5, 4);
assert_eq!(a, T2(8, 8));

let b = T2(3u32, 4.0f32) * T2(7, 3.0);
assert_eq!(b, T2(21, 12.));
# }
```

## Adding a Trait
```
#[macro_use]
extern crate tuple;
extern crate num_traits;

use tuple::*;
use num_traits::Zero;
use std::ops::{Add, Sub, Mul};
use std::fmt::Debug;

trait Ring: Add + Sub + Mul + Zero + Debug + Sized {}

// The name is up to you
macro_rules! impl_ring {
    // This line is defined by this crate and can't be changed
    ($($Tuple:ident { $($idx:tt -> $T:ident),* } )*) => ($(

        // This is expanded for every Tuple type
        impl<$($T),*> Ring for $Tuple<$($T),*> where Self: Zero, $( $T: Ring ),* {}

    // this has to match again
    )*)
}

// actually implement it!
impl_tuple!(impl_ring);

# fn main() {
# }
```
**/

#![feature(associated_consts)]
#![feature(trace_macros)]
#![feature(try_from)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
//#![no_std]



//extern crate itertools;


// this defines the macro that w

use std::ops::{Add, Sub, Mul, Div, Index, IndexMut};
use std::iter::Iterator;
use std::fmt;
use std::convert::TryFrom;

pub struct Elements<T> {
    tuple: T,
    index: usize,
}

pub trait TupleElements {
    type
    Element;
    const
    N:
    usize;

    /// returns an Iterator over the elements of the tuple
    fn elements(&self)
    -> Elements<&Self>;

    /// attempt to access the n-th element
    fn get(&self, n: usize)
    -> Option<&Self::Element>;

    /// attempt to access the n-th element mutablbly.
    fn get_mut(&mut self, n: usize)
    -> Option<&mut Self::Element>;
}

impl <'a, T> Iterator for Elements<&'a T> where T: TupleElements {
    type
    Item
    =
    &'a T::Element;
    fn next(&mut self) -> Option<Self::Item> {
        let t = self.tuple.get(self.index);
        if let Some(_) = t { self.index += 1; }
        t
    }
}

pub trait Tuple {
    type
    Tuple;
    fn into_tuple(self)
    -> Self::Tuple;
}

macro_rules! A(( $ a : ident , $ b : ident ) => ( $ a ));
macro_rules! a(( $ a : expr , $ b : expr ) => ( $ a ));
macro_rules! Rev(( @ $ a : ident ; $ ( $ b : ident ) , * ) => (
                 ( $ a $ ( , $ b ) * ) ) ; (
                 @ $ a : ident $ ( , $ b : ident ) * ; $ ( $ c : ident ) , * )
                 => ( Rev ! ( @ $ ( $ b ) , * ; $ a $ ( , $ c ) * ) ) ; (
                 $ a : ident ) => ( $ a ) ; (
                 $ a : ident $ ( , $ b : ident ) * ) => (
                 Rev ! ( @ $ ( $ b ) , * ; $ a ) ) ;);
macro_rules! rev(( @ $ a : expr ; $ ( $ b : expr ) , * ) => (
                 ( $ a $ ( , $ b ) * ) ) ; (
                 @ $ a : expr $ ( , $ b : expr ) * ; $ ( $ c : expr ) , * ) =>
                 ( rev ! ( @ $ ( $ b ) , * ; $ a $ ( , $ c ) * ) ) ; (
                 $ a : expr ) => ( $ a ) ; ( $ a : expr $ ( , $ b : expr ) * )
                 => ( rev ! ( @ $ ( $ b ) , * ; $ a ) ) ;);

#[macro_export]
macro_rules! impl_tuple(( $ def : ident ) => (
                        $ def ! (
                        T1 { 0 -> A } T2 { 0 -> A , 1 -> B } T3 {
                        0 -> A , 1 -> B , 2 -> C } T4 {
                        0 -> A , 1 -> B , 2 -> C , 3 -> D } T5 {
                        0 -> A , 1 -> B , 2 -> C , 3 -> D , 4 -> E } T6 {
                        0 -> A , 1 -> B , 2 -> C , 3 -> D , 4 -> E , 5 -> F }
                        T7 {
                        0 -> A , 1 -> B , 2 -> C , 3 -> D , 4 -> E , 5 -> F ,
                        6 -> G } T8 {
                        0 -> A , 1 -> B , 2 -> C , 3 -> D , 4 -> E , 5 -> F ,
                        6 -> G , 7 -> H } ) ; ));

#[macro_use]
mod m_init {



    /*
    use itertools::tuple_impl::TupleCollect;
    #[macro_use]
    mod impl_itertools;
    trace_macros!(true);
    impl_tuple!(impl_itertools);
    */
    macro_rules! m_init((
                        $ (
                        $ Tuple : ident { $ ( $ idx : tt -> $ T : ident ) , *
                        } ) * ) => (
                        $ (
                        pub struct $ Tuple < $ ( $ T ) , * > (
                        $ ( pub $ T ) , * ) ; impl < $ ( $ T ) , * > Tuple for
                        $ Tuple < $ ( $ T ) , * > {
                        type Tuple = ( $ ( $ T ) , * ) ; fn into_tuple ( self
                        ) -> Self :: Tuple { ( $ ( self . $ idx ) , * ) } }
                        impl < $ ( $ T ) , * > Clone for $ Tuple < $ ( $ T ) ,
                        * > where $ ( $ T : Clone ) , * {
                        fn clone ( & self ) -> Self {
                        $ Tuple ( $ ( self . $ idx . clone (  ) ) , * ) } }
                        impl < $ ( $ T ) , * > Copy for $ Tuple < $ ( $ T ) ,
                        * > where $ ( $ T : Copy ) , * {  } impl < $ ( $ T ) ,
                        * > PartialEq for $ Tuple < $ ( $ T ) , * > where $ (
                        $ T : PartialEq ) , * {
                        fn eq ( & self , other : & Self ) -> bool {
                        $ ( self . $ idx == other . $ idx ) && * } } impl < $
                        ( $ T ) , * > fmt :: Debug for $ Tuple < $ ( $ T ) , *
                        > where $ ( $ T : fmt :: Debug ) , * {
                        fn fmt ( & self , f : & mut fmt :: Formatter ) -> fmt
                        :: Result { ( $ ( & self . $ idx ) , * ) . fmt ( f ) }
                        } impl < $ ( $ T ) , * > Add for $ Tuple < $ ( $ T ) ,
                        * > where $ ( $ T : Add ) , * {
                        type Output = $ Tuple < $ ( $ T :: Output ) , * > ; fn
                        add ( self , rhs : Self ) -> Self :: Output {
                        $ Tuple ( $ ( self . $ idx + rhs . $ idx ) , * ) } }
                        impl < $ ( $ T ) , * > Sub for $ Tuple < $ ( $ T ) , *
                        > where $ ( $ T : Sub ) , * {
                        type Output = $ Tuple < $ ( $ T :: Output ) , * > ; fn
                        sub ( self , rhs : Self ) -> Self :: Output {
                        $ Tuple ( $ ( self . $ idx - rhs . $ idx ) , * ) } }
                        impl < $ ( $ T ) , * > Mul for $ Tuple < $ ( $ T ) , *
                        > where $ ( $ T : Mul ) , * {
                        type Output = $ Tuple < $ ( $ T :: Output ) , * > ; fn
                        mul ( self , rhs : Self ) -> Self :: Output {
                        $ Tuple ( $ ( self . $ idx * rhs . $ idx ) , * ) } }
                        impl < $ ( $ T ) , * > Div for $ Tuple < $ ( $ T ) , *
                        > where $ ( $ T : Div ) , * {
                        type Output = $ Tuple < $ ( $ T :: Output ) , * > ; fn
                        div ( self , rhs : Self ) -> Self :: Output {
                        $ Tuple ( $ ( self . $ idx / rhs . $ idx ) , * ) } }
                        impl < $ ( $ T ) , * > From < u16 > for $ Tuple < $ (
                        $ T ) , * > where $ ( $ T : From < u16 > ) , * {
                        fn from ( value : u16 ) -> Self {
                        $ Tuple ( $ ( $ T :: from ( value ) ) , * ) } } impl <
                        $ ( $ T ) , * > Iterator for $ Tuple < $ ( $ T ) , * >
                        where $ ( $ T : Iterator ) , * {
                        type Item = $ Tuple < $ ( $ T :: Item ) , * > ; # [
                        allow ( non_snake_case ) ] fn next ( & mut self ) ->
                        Option < Self :: Item > {
                        match ( $ ( self . $ idx . next (  ) , ) * ) {
                        ( $ ( Some ( $ T ) , ) * ) => Some (
                        $ Tuple ( $ ( $ T ) , * ) ) , _ => None } } } impl < T
                        > TupleElements for $ Tuple < $ ( A ! ( T , $ T ) ) ,
                        * > {
                        type Element = T ; const N : usize = $ (
                        a ! ( 1 , $ idx ) + ) * 0 ; fn elements ( & self ) ->
                        Elements < & Self > {
                        Elements { tuple : self , index : 0 } } fn get (
                        & self , index : usize ) -> Option < & T > {
                        match index {
                        $ ( $ idx => Some ( & self . $ idx ) , ) * _ => None }
                        } fn get_mut ( & mut self , index : usize ) -> Option
                        < & mut T > {
                        match index {
                        $ ( $ idx => Some ( & self . $ idx ) , ) * _ => None }
                        } } impl < T > Index < usize > for $ Tuple < $ (
                        A ! ( T , $ T ) ) , * > {
                        type Output = T ; fn index ( & self , index : usize )
                        -> & T {
                        match index {
                        $ ( $ idx => & self . $ idx , ) * _ => & self . 0 } }
                        } impl < T > IndexMut < usize > for $ Tuple < $ (
                        A ! ( T , $ T ) ) , * > {
                        fn index_mut ( & mut self , index : usize ) -> & mut T
                        {
                        match index {
                        $ ( $ idx => & mut self . $ idx , ) * _ => & mut self
                        . 0 } } } ) * ));
}
pub struct T1<A>(pub A);
impl <A> Tuple for T1<A> {
    type
    Tuple
    =
    (A);
    fn into_tuple(self) -> Self::Tuple { (self.0) }
}
impl <A> Clone for T1<A> where A: Clone {
    fn clone(&self) -> Self { T1(self.0.clone()) }
}
impl <A> Copy for T1<A> where A: Copy { }
impl <A> PartialEq for T1<A> where A: PartialEq {
    fn eq(&self, other: &Self) -> bool { self.0 == other.0 }
}
impl <A> fmt::Debug for T1<A> where A: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (&self.0).fmt(f) }
}
impl <A> Add for T1<A> where A: Add {
    type
    Output
    =
    T1<A::Output>;
    fn add(self, rhs: Self) -> Self::Output { T1(self.0 + rhs.0) }
}
impl <A> Sub for T1<A> where A: Sub {
    type
    Output
    =
    T1<A::Output>;
    fn sub(self, rhs: Self) -> Self::Output { T1(self.0 - rhs.0) }
}
impl <A> Mul for T1<A> where A: Mul {
    type
    Output
    =
    T1<A::Output>;
    fn mul(self, rhs: Self) -> Self::Output { T1(self.0 * rhs.0) }
}
impl <A> Div for T1<A> where A: Div {
    type
    Output
    =
    T1<A::Output>;
    fn div(self, rhs: Self) -> Self::Output { T1(self.0 / rhs.0) }
}
impl <A> From<u16> for T1<A> where A: From<u16> {
    fn from(value: u16) -> Self { T1(A::from(value)) }
}
impl <A> Iterator for T1<A> where A: Iterator {
    type
    Item
    =
    T1<A::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(),) { (Some(A),) => Some(T1(A)), _ => None, }
    }
}
impl <T> TupleElements for T1<T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index { 0 => Some(&self.0), _ => None, }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index { 0 => Some(&self.0), _ => None, }
    }
}
impl <T> Index<usize> for T1<T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index { 0 => &self.0, _ => &self.0, }
    }
}
impl <T> IndexMut<usize> for T1<T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index { 0 => &mut self.0, _ => &mut self.0, }
    }
}
pub struct T2<A, B>(pub A, pub B);
impl <A, B> Tuple for T2<A, B> {
    type
    Tuple
    =
    (A, B);
    fn into_tuple(self) -> Self::Tuple { (self.0, self.1) }
}
impl <A, B> Clone for T2<A, B> where A: Clone, B: Clone {
    fn clone(&self) -> Self { T2(self.0.clone(), self.1.clone()) }
}
impl <A, B> Copy for T2<A, B> where A: Copy, B: Copy { }
impl <A, B> PartialEq for T2<A, B> where A: PartialEq, B: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1
    }
}
impl <A, B> fmt::Debug for T2<A, B> where A: fmt::Debug, B: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1).fmt(f)
    }
}
impl <A, B> Add for T2<A, B> where A: Add, B: Add {
    type
    Output
    =
    T2<A::Output, B::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T2(self.0 + rhs.0, self.1 + rhs.1)
    }
}
impl <A, B> Sub for T2<A, B> where A: Sub, B: Sub {
    type
    Output
    =
    T2<A::Output, B::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T2(self.0 - rhs.0, self.1 - rhs.1)
    }
}
impl <A, B> Mul for T2<A, B> where A: Mul, B: Mul {
    type
    Output
    =
    T2<A::Output, B::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T2(self.0 * rhs.0, self.1 * rhs.1)
    }
}
impl <A, B> Div for T2<A, B> where A: Div, B: Div {
    type
    Output
    =
    T2<A::Output, B::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T2(self.0 / rhs.0, self.1 / rhs.1)
    }
}
impl <A, B> From<u16> for T2<A, B> where A: From<u16>, B: From<u16> {
    fn from(value: u16) -> Self { T2(A::from(value), B::from(value)) }
}
impl <A, B> Iterator for T2<A, B> where A: Iterator, B: Iterator {
    type
    Item
    =
    T2<A::Item, B::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next()) {
            (Some(A), Some(B)) => Some(T2(A, B)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T2<T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index { 0 => Some(&self.0), 1 => Some(&self.1), _ => None, }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index { 0 => Some(&self.0), 1 => Some(&self.1), _ => None, }
    }
}
impl <T> Index<usize> for T2<T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index { 0 => &self.0, 1 => &self.1, _ => &self.0, }
    }
}
impl <T> IndexMut<usize> for T2<T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index { 0 => &mut self.0, 1 => &mut self.1, _ => &mut self.0, }
    }
}
pub struct T3<A, B, C>(pub A, pub B, pub C);
impl <A, B, C> Tuple for T3<A, B, C> {
    type
    Tuple
    =
    (A, B, C);
    fn into_tuple(self) -> Self::Tuple { (self.0, self.1, self.2) }
}
impl <A, B, C> Clone for T3<A, B, C> where A: Clone, B: Clone, C: Clone {
    fn clone(&self) -> Self {
        T3(self.0.clone(), self.1.clone(), self.2.clone())
    }
}
impl <A, B, C> Copy for T3<A, B, C> where A: Copy, B: Copy, C: Copy { }
impl <A, B, C> PartialEq for T3<A, B, C> where A: PartialEq, B: PartialEq,
 C: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2
    }
}
impl <A, B, C> fmt::Debug for T3<A, B, C> where A: fmt::Debug, B: fmt::Debug,
 C: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2).fmt(f)
    }
}
impl <A, B, C> Add for T3<A, B, C> where A: Add, B: Add, C: Add {
    type
    Output
    =
    T3<A::Output, B::Output, C::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T3(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2)
    }
}
impl <A, B, C> Sub for T3<A, B, C> where A: Sub, B: Sub, C: Sub {
    type
    Output
    =
    T3<A::Output, B::Output, C::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T3(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2)
    }
}
impl <A, B, C> Mul for T3<A, B, C> where A: Mul, B: Mul, C: Mul {
    type
    Output
    =
    T3<A::Output, B::Output, C::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T3(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2)
    }
}
impl <A, B, C> Div for T3<A, B, C> where A: Div, B: Div, C: Div {
    type
    Output
    =
    T3<A::Output, B::Output, C::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T3(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2)
    }
}
impl <A, B, C> From<u16> for T3<A, B, C> where A: From<u16>, B: From<u16>,
 C: From<u16> {
    fn from(value: u16) -> Self {
        T3(A::from(value), B::from(value), C::from(value))
    }
}
impl <A, B, C> Iterator for T3<A, B, C> where A: Iterator, B: Iterator,
 C: Iterator {
    type
    Item
    =
    T3<A::Item, B::Item, C::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next()) {
            (Some(A), Some(B), Some(C)) => Some(T3(A, B, C)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T3<T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T3<T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T3<T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            _ => &mut self.0,
        }
    }
}
pub struct T4<A, B, C, D>(pub A, pub B, pub C, pub D);
impl <A, B, C, D> Tuple for T4<A, B, C, D> {
    type
    Tuple
    =
    (A, B, C, D);
    fn into_tuple(self) -> Self::Tuple { (self.0, self.1, self.2, self.3) }
}
impl <A, B, C, D> Clone for T4<A, B, C, D> where A: Clone, B: Clone, C: Clone,
 D: Clone {
    fn clone(&self) -> Self {
        T4(self.0.clone(), self.1.clone(), self.2.clone(), self.3.clone())
    }
}
impl <A, B, C, D> Copy for T4<A, B, C, D> where A: Copy, B: Copy, C: Copy,
 D: Copy {
}
impl <A, B, C, D> PartialEq for T4<A, B, C, D> where A: PartialEq,
 B: PartialEq, C: PartialEq, D: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
            self.3 == other.3
    }
}
impl <A, B, C, D> fmt::Debug for T4<A, B, C, D> where A: fmt::Debug,
 B: fmt::Debug, C: fmt::Debug, D: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2, &self.3).fmt(f)
    }
}
impl <A, B, C, D> Add for T4<A, B, C, D> where A: Add, B: Add, C: Add, D: Add
 {
    type
    Output
    =
    T4<A::Output, B::Output, C::Output, D::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T4(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2, self.3 + rhs.3)
    }
}
impl <A, B, C, D> Sub for T4<A, B, C, D> where A: Sub, B: Sub, C: Sub, D: Sub
 {
    type
    Output
    =
    T4<A::Output, B::Output, C::Output, D::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T4(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2, self.3 - rhs.3)
    }
}
impl <A, B, C, D> Mul for T4<A, B, C, D> where A: Mul, B: Mul, C: Mul, D: Mul
 {
    type
    Output
    =
    T4<A::Output, B::Output, C::Output, D::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T4(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2, self.3 * rhs.3)
    }
}
impl <A, B, C, D> Div for T4<A, B, C, D> where A: Div, B: Div, C: Div, D: Div
 {
    type
    Output
    =
    T4<A::Output, B::Output, C::Output, D::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T4(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2, self.3 / rhs.3)
    }
}
impl <A, B, C, D> From<u16> for T4<A, B, C, D> where A: From<u16>,
 B: From<u16>, C: From<u16>, D: From<u16> {
    fn from(value: u16) -> Self {
        T4(A::from(value), B::from(value), C::from(value), D::from(value))
    }
}
impl <A, B, C, D> Iterator for T4<A, B, C, D> where A: Iterator, B: Iterator,
 C: Iterator, D: Iterator {
    type
    Item
    =
    T4<A::Item, B::Item, C::Item, D::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next(), self.3.next()) {
            (Some(A), Some(B), Some(C), Some(D)) => Some(T4(A, B, C, D)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T4<T, T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T4<T, T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            3 => &self.3,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T4<T, T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            3 => &mut self.3,
            _ => &mut self.0,
        }
    }
}
pub struct T5<A, B, C, D, E>(pub A, pub B, pub C, pub D, pub E);
impl <A, B, C, D, E> Tuple for T5<A, B, C, D, E> {
    type
    Tuple
    =
    (A, B, C, D, E);
    fn into_tuple(self) -> Self::Tuple {
        (self.0, self.1, self.2, self.3, self.4)
    }
}
impl <A, B, C, D, E> Clone for T5<A, B, C, D, E> where A: Clone, B: Clone,
 C: Clone, D: Clone, E: Clone {
    fn clone(&self) -> Self {
        T5(self.0.clone(), self.1.clone(), self.2.clone(), self.3.clone(),
           self.4.clone())
    }
}
impl <A, B, C, D, E> Copy for T5<A, B, C, D, E> where A: Copy, B: Copy,
 C: Copy, D: Copy, E: Copy {
}
impl <A, B, C, D, E> PartialEq for T5<A, B, C, D, E> where A: PartialEq,
 B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
            self.3 == other.3 && self.4 == other.4
    }
}
impl <A, B, C, D, E> fmt::Debug for T5<A, B, C, D, E> where A: fmt::Debug,
 B: fmt::Debug, C: fmt::Debug, D: fmt::Debug, E: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2, &self.3, &self.4).fmt(f)
    }
}
impl <A, B, C, D, E> Add for T5<A, B, C, D, E> where A: Add, B: Add, C: Add,
 D: Add, E: Add {
    type
    Output
    =
    T5<A::Output, B::Output, C::Output, D::Output, E::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T5(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2, self.3 + rhs.3,
           self.4 + rhs.4)
    }
}
impl <A, B, C, D, E> Sub for T5<A, B, C, D, E> where A: Sub, B: Sub, C: Sub,
 D: Sub, E: Sub {
    type
    Output
    =
    T5<A::Output, B::Output, C::Output, D::Output, E::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T5(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2, self.3 - rhs.3,
           self.4 - rhs.4)
    }
}
impl <A, B, C, D, E> Mul for T5<A, B, C, D, E> where A: Mul, B: Mul, C: Mul,
 D: Mul, E: Mul {
    type
    Output
    =
    T5<A::Output, B::Output, C::Output, D::Output, E::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T5(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2, self.3 * rhs.3,
           self.4 * rhs.4)
    }
}
impl <A, B, C, D, E> Div for T5<A, B, C, D, E> where A: Div, B: Div, C: Div,
 D: Div, E: Div {
    type
    Output
    =
    T5<A::Output, B::Output, C::Output, D::Output, E::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T5(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2, self.3 / rhs.3,
           self.4 / rhs.4)
    }
}
impl <A, B, C, D, E> From<u16> for T5<A, B, C, D, E> where A: From<u16>,
 B: From<u16>, C: From<u16>, D: From<u16>, E: From<u16> {
    fn from(value: u16) -> Self {
        T5(A::from(value), B::from(value), C::from(value), D::from(value),
           E::from(value))
    }
}
impl <A, B, C, D, E> Iterator for T5<A, B, C, D, E> where A: Iterator,
 B: Iterator, C: Iterator, D: Iterator, E: Iterator {
    type
    Item
    =
    T5<A::Item, B::Item, C::Item, D::Item, E::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next(), self.3.next(),
               self.4.next()) {
            (Some(A), Some(B), Some(C), Some(D), Some(E)) =>
            Some(T5(A, B, C, D, E)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T5<T, T, T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T5<T, T, T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            3 => &self.3,
            4 => &self.4,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T5<T, T, T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            3 => &mut self.3,
            4 => &mut self.4,
            _ => &mut self.0,
        }
    }
}
pub struct T6<A, B, C, D, E, F>(pub A, pub B, pub C, pub D, pub E, pub F);
impl <A, B, C, D, E, F> Tuple for T6<A, B, C, D, E, F> {
    type
    Tuple
    =
    (A, B, C, D, E, F);
    fn into_tuple(self) -> Self::Tuple {
        (self.0, self.1, self.2, self.3, self.4, self.5)
    }
}
impl <A, B, C, D, E, F> Clone for T6<A, B, C, D, E, F> where A: Clone,
 B: Clone, C: Clone, D: Clone, E: Clone, F: Clone {
    fn clone(&self) -> Self {
        T6(self.0.clone(), self.1.clone(), self.2.clone(), self.3.clone(),
           self.4.clone(), self.5.clone())
    }
}
impl <A, B, C, D, E, F> Copy for T6<A, B, C, D, E, F> where A: Copy, B: Copy,
 C: Copy, D: Copy, E: Copy, F: Copy {
}
impl <A, B, C, D, E, F> PartialEq for T6<A, B, C, D, E, F> where A: PartialEq,
 B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq, F: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
            self.3 == other.3 && self.4 == other.4 && self.5 == other.5
    }
}
impl <A, B, C, D, E, F> fmt::Debug for T6<A, B, C, D, E, F> where
 A: fmt::Debug, B: fmt::Debug, C: fmt::Debug, D: fmt::Debug, E: fmt::Debug,
 F: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2, &self.3, &self.4, &self.5).fmt(f)
    }
}
impl <A, B, C, D, E, F> Add for T6<A, B, C, D, E, F> where A: Add, B: Add,
 C: Add, D: Add, E: Add, F: Add {
    type
    Output
    =
    T6<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T6(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2, self.3 + rhs.3,
           self.4 + rhs.4, self.5 + rhs.5)
    }
}
impl <A, B, C, D, E, F> Sub for T6<A, B, C, D, E, F> where A: Sub, B: Sub,
 C: Sub, D: Sub, E: Sub, F: Sub {
    type
    Output
    =
    T6<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T6(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2, self.3 - rhs.3,
           self.4 - rhs.4, self.5 - rhs.5)
    }
}
impl <A, B, C, D, E, F> Mul for T6<A, B, C, D, E, F> where A: Mul, B: Mul,
 C: Mul, D: Mul, E: Mul, F: Mul {
    type
    Output
    =
    T6<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T6(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2, self.3 * rhs.3,
           self.4 * rhs.4, self.5 * rhs.5)
    }
}
impl <A, B, C, D, E, F> Div for T6<A, B, C, D, E, F> where A: Div, B: Div,
 C: Div, D: Div, E: Div, F: Div {
    type
    Output
    =
    T6<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T6(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2, self.3 / rhs.3,
           self.4 / rhs.4, self.5 / rhs.5)
    }
}
impl <A, B, C, D, E, F> From<u16> for T6<A, B, C, D, E, F> where A: From<u16>,
 B: From<u16>, C: From<u16>, D: From<u16>, E: From<u16>, F: From<u16> {
    fn from(value: u16) -> Self {
        T6(A::from(value), B::from(value), C::from(value), D::from(value),
           E::from(value), F::from(value))
    }
}
impl <A, B, C, D, E, F> Iterator for T6<A, B, C, D, E, F> where A: Iterator,
 B: Iterator, C: Iterator, D: Iterator, E: Iterator, F: Iterator {
    type
    Item
    =
    T6<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next(), self.3.next(),
               self.4.next(), self.5.next()) {
            (Some(A), Some(B), Some(C), Some(D), Some(E), Some(F)) =>
            Some(T6(A, B, C, D, E, F)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T6<T, T, T, T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T6<T, T, T, T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            3 => &self.3,
            4 => &self.4,
            5 => &self.5,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T6<T, T, T, T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            3 => &mut self.3,
            4 => &mut self.4,
            5 => &mut self.5,
            _ => &mut self.0,
        }
    }
}
pub struct T7<A, B, C, D, E, F,
              G>(pub A, pub B, pub C, pub D, pub E, pub F, pub G);
impl <A, B, C, D, E, F, G> Tuple for T7<A, B, C, D, E, F, G> {
    type
    Tuple
    =
    (A, B, C, D, E, F, G);
    fn into_tuple(self) -> Self::Tuple {
        (self.0, self.1, self.2, self.3, self.4, self.5, self.6)
    }
}
impl <A, B, C, D, E, F, G> Clone for T7<A, B, C, D, E, F, G> where A: Clone,
 B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone {
    fn clone(&self) -> Self {
        T7(self.0.clone(), self.1.clone(), self.2.clone(), self.3.clone(),
           self.4.clone(), self.5.clone(), self.6.clone())
    }
}
impl <A, B, C, D, E, F, G> Copy for T7<A, B, C, D, E, F, G> where A: Copy,
 B: Copy, C: Copy, D: Copy, E: Copy, F: Copy, G: Copy {
}
impl <A, B, C, D, E, F, G> PartialEq for T7<A, B, C, D, E, F, G> where
 A: PartialEq, B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq,
 F: PartialEq, G: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
            self.3 == other.3 && self.4 == other.4 && self.5 == other.5 &&
            self.6 == other.6
    }
}
impl <A, B, C, D, E, F, G> fmt::Debug for T7<A, B, C, D, E, F, G> where
 A: fmt::Debug, B: fmt::Debug, C: fmt::Debug, D: fmt::Debug, E: fmt::Debug,
 F: fmt::Debug, G: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2, &self.3, &self.4, &self.5, &self.6).fmt(f)
    }
}
impl <A, B, C, D, E, F, G> Add for T7<A, B, C, D, E, F, G> where A: Add,
 B: Add, C: Add, D: Add, E: Add, F: Add, G: Add {
    type
    Output
    =
    T7<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T7(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2, self.3 + rhs.3,
           self.4 + rhs.4, self.5 + rhs.5, self.6 + rhs.6)
    }
}
impl <A, B, C, D, E, F, G> Sub for T7<A, B, C, D, E, F, G> where A: Sub,
 B: Sub, C: Sub, D: Sub, E: Sub, F: Sub, G: Sub {
    type
    Output
    =
    T7<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T7(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2, self.3 - rhs.3,
           self.4 - rhs.4, self.5 - rhs.5, self.6 - rhs.6)
    }
}
impl <A, B, C, D, E, F, G> Mul for T7<A, B, C, D, E, F, G> where A: Mul,
 B: Mul, C: Mul, D: Mul, E: Mul, F: Mul, G: Mul {
    type
    Output
    =
    T7<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T7(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2, self.3 * rhs.3,
           self.4 * rhs.4, self.5 * rhs.5, self.6 * rhs.6)
    }
}
impl <A, B, C, D, E, F, G> Div for T7<A, B, C, D, E, F, G> where A: Div,
 B: Div, C: Div, D: Div, E: Div, F: Div, G: Div {
    type
    Output
    =
    T7<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T7(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2, self.3 / rhs.3,
           self.4 / rhs.4, self.5 / rhs.5, self.6 / rhs.6)
    }
}
impl <A, B, C, D, E, F, G> From<u16> for T7<A, B, C, D, E, F, G> where
 A: From<u16>, B: From<u16>, C: From<u16>, D: From<u16>, E: From<u16>,
 F: From<u16>, G: From<u16> {
    fn from(value: u16) -> Self {
        T7(A::from(value), B::from(value), C::from(value), D::from(value),
           E::from(value), F::from(value), G::from(value))
    }
}
impl <A, B, C, D, E, F, G> Iterator for T7<A, B, C, D, E, F, G> where
 A: Iterator, B: Iterator, C: Iterator, D: Iterator, E: Iterator, F: Iterator,
 G: Iterator {
    type
    Item
    =
    T7<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next(), self.3.next(),
               self.4.next(), self.5.next(), self.6.next()) {
            (Some(A), Some(B), Some(C), Some(D), Some(E), Some(F), Some(G)) =>
            Some(T7(A, B, C, D, E, F, G)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T7<T, T, T, T, T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T7<T, T, T, T, T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            3 => &self.3,
            4 => &self.4,
            5 => &self.5,
            6 => &self.6,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T7<T, T, T, T, T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            3 => &mut self.3,
            4 => &mut self.4,
            5 => &mut self.5,
            6 => &mut self.6,
            _ => &mut self.0,
        }
    }
}
pub struct T8<A, B, C, D, E, F, G,
              H>(pub A, pub B, pub C, pub D, pub E, pub F, pub G, pub H);
impl <A, B, C, D, E, F, G, H> Tuple for T8<A, B, C, D, E, F, G, H> {
    type
    Tuple
    =
    (A, B, C, D, E, F, G, H);
    fn into_tuple(self) -> Self::Tuple {
        (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7)
    }
}
impl <A, B, C, D, E, F, G, H> Clone for T8<A, B, C, D, E, F, G, H> where
 A: Clone, B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone,
 H: Clone {
    fn clone(&self) -> Self {
        T8(self.0.clone(), self.1.clone(), self.2.clone(), self.3.clone(),
           self.4.clone(), self.5.clone(), self.6.clone(), self.7.clone())
    }
}
impl <A, B, C, D, E, F, G, H> Copy for T8<A, B, C, D, E, F, G, H> where
 A: Copy, B: Copy, C: Copy, D: Copy, E: Copy, F: Copy, G: Copy, H: Copy {
}
impl <A, B, C, D, E, F, G, H> PartialEq for T8<A, B, C, D, E, F, G, H> where
 A: PartialEq, B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq,
 F: PartialEq, G: PartialEq, H: PartialEq {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
            self.3 == other.3 && self.4 == other.4 && self.5 == other.5 &&
            self.6 == other.6 && self.7 == other.7
    }
}
impl <A, B, C, D, E, F, G, H> fmt::Debug for T8<A, B, C, D, E, F, G, H> where
 A: fmt::Debug, B: fmt::Debug, C: fmt::Debug, D: fmt::Debug, E: fmt::Debug,
 F: fmt::Debug, G: fmt::Debug, H: fmt::Debug {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        (&self.0, &self.1, &self.2, &self.3, &self.4, &self.5, &self.6,
         &self.7).fmt(f)
    }
}
impl <A, B, C, D, E, F, G, H> Add for T8<A, B, C, D, E, F, G, H> where A: Add,
 B: Add, C: Add, D: Add, E: Add, F: Add, G: Add, H: Add {
    type
    Output
    =
    T8<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output, H::Output>;
    fn add(self, rhs: Self) -> Self::Output {
        T8(self.0 + rhs.0, self.1 + rhs.1, self.2 + rhs.2, self.3 + rhs.3,
           self.4 + rhs.4, self.5 + rhs.5, self.6 + rhs.6, self.7 + rhs.7)
    }
}
impl <A, B, C, D, E, F, G, H> Sub for T8<A, B, C, D, E, F, G, H> where A: Sub,
 B: Sub, C: Sub, D: Sub, E: Sub, F: Sub, G: Sub, H: Sub {
    type
    Output
    =
    T8<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output, H::Output>;
    fn sub(self, rhs: Self) -> Self::Output {
        T8(self.0 - rhs.0, self.1 - rhs.1, self.2 - rhs.2, self.3 - rhs.3,
           self.4 - rhs.4, self.5 - rhs.5, self.6 - rhs.6, self.7 - rhs.7)
    }
}
impl <A, B, C, D, E, F, G, H> Mul for T8<A, B, C, D, E, F, G, H> where A: Mul,
 B: Mul, C: Mul, D: Mul, E: Mul, F: Mul, G: Mul, H: Mul {
    type
    Output
    =
    T8<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output, H::Output>;
    fn mul(self, rhs: Self) -> Self::Output {
        T8(self.0 * rhs.0, self.1 * rhs.1, self.2 * rhs.2, self.3 * rhs.3,
           self.4 * rhs.4, self.5 * rhs.5, self.6 * rhs.6, self.7 * rhs.7)
    }
}
impl <A, B, C, D, E, F, G, H> Div for T8<A, B, C, D, E, F, G, H> where A: Div,
 B: Div, C: Div, D: Div, E: Div, F: Div, G: Div, H: Div {
    type
    Output
    =
    T8<A::Output, B::Output, C::Output, D::Output, E::Output, F::Output,
       G::Output, H::Output>;
    fn div(self, rhs: Self) -> Self::Output {
        T8(self.0 / rhs.0, self.1 / rhs.1, self.2 / rhs.2, self.3 / rhs.3,
           self.4 / rhs.4, self.5 / rhs.5, self.6 / rhs.6, self.7 / rhs.7)
    }
}
impl <A, B, C, D, E, F, G, H> From<u16> for T8<A, B, C, D, E, F, G, H> where
 A: From<u16>, B: From<u16>, C: From<u16>, D: From<u16>, E: From<u16>,
 F: From<u16>, G: From<u16>, H: From<u16> {
    fn from(value: u16) -> Self {
        T8(A::from(value), B::from(value), C::from(value), D::from(value),
           E::from(value), F::from(value), G::from(value), H::from(value))
    }
}
impl <A, B, C, D, E, F, G, H> Iterator for T8<A, B, C, D, E, F, G, H> where
 A: Iterator, B: Iterator, C: Iterator, D: Iterator, E: Iterator, F: Iterator,
 G: Iterator, H: Iterator {
    type
    Item
    =
    T8<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item,
       H::Item>;
    #[allow(non_snake_case)]
    fn next(&mut self) -> Option<Self::Item> {
        match (self.0.next(), self.1.next(), self.2.next(), self.3.next(),
               self.4.next(), self.5.next(), self.6.next(), self.7.next()) {
            (Some(A), Some(B), Some(C), Some(D), Some(E), Some(F), Some(G),
             Some(H)) => Some(T8(A, B, C, D, E, F, G, H)),
            _ => None,
        }
    }
}
impl <T> TupleElements for T8<T, T, T, T, T, T, T, T> {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            7 => Some(&self.7),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            7 => Some(&self.7),
            _ => None,
        }
    }
}
impl <T> Index<usize> for T8<T, T, T, T, T, T, T, T> {
    type
    Output
    =
    T;
    fn index(&self, index: usize) -> &T {
        match index {
            0 => &self.0,
            1 => &self.1,
            2 => &self.2,
            3 => &self.3,
            4 => &self.4,
            5 => &self.5,
            6 => &self.6,
            7 => &self.7,
            _ => &self.0,
        }
    }
}
impl <T> IndexMut<usize> for T8<T, T, T, T, T, T, T, T> {
    fn index_mut(&mut self, index: usize) -> &mut T {
        match index {
            0 => &mut self.0,
            1 => &mut self.1,
            2 => &mut self.2,
            3 => &mut self.3,
            4 => &mut self.4,
            5 => &mut self.5,
            6 => &mut self.6,
            7 => &mut self.7,
            _ => &mut self.0,
        }
    }
}
#[macro_use]
mod m_tuple {
    macro_rules! m_tuple((
                         $ (
                         $ Tuple : ident { $ ( $ idx : tt -> $ T : ident ) , *
                         } ) * ) => (
                         $ (
                         impl < T > TupleElements for (
                         $ ( A ! ( T , $ T ) , ) * ) {
                         type Element = T ; const N : usize = $ (
                         a ! ( 1 , $ idx ) + ) * 0 ; fn elements ( & self ) ->
                         Elements < & Self > {
                         Elements { tuple : self , index : 0 } } fn get (
                         & self , index : usize ) -> Option < & T > {
                         match index {
                         $ ( $ idx => Some ( & self . $ idx ) , ) * _ => None
                         } } fn get_mut ( & mut self , index : usize ) ->
                         Option < & mut T > {
                         match index {
                         $ ( $ idx => Some ( & self . $ idx ) , ) * _ => None
                         } } } ) * ));
}
impl <T> TupleElements for (T,) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index { 0 => Some(&self.0), _ => None, }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index { 0 => Some(&self.0), _ => None, }
    }
}
impl <T> TupleElements for (T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index { 0 => Some(&self.0), 1 => Some(&self.1), _ => None, }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index { 0 => Some(&self.0), 1 => Some(&self.1), _ => None, }
    }
}
impl <T> TupleElements for (T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            _ => None,
        }
    }
}
impl <T> TupleElements for (T, T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            _ => None,
        }
    }
}
impl <T> TupleElements for (T, T, T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            _ => None,
        }
    }
}
impl <T> TupleElements for (T, T, T, T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            _ => None,
        }
    }
}
impl <T> TupleElements for (T, T, T, T, T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            _ => None,
        }
    }
}
impl <T> TupleElements for (T, T, T, T, T, T, T, T) {
    type
    Element
    =
    T;
    const
    N:
    usize
    =
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0;
    fn elements(&self) -> Elements<&Self> { Elements{tuple: self, index: 0,} }
    fn get(&self, index: usize) -> Option<&T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            7 => Some(&self.7),
            _ => None,
        }
    }
    fn get_mut(&mut self, index: usize) -> Option<&mut T> {
        match index {
            0 => Some(&self.0),
            1 => Some(&self.1),
            2 => Some(&self.2),
            3 => Some(&self.3),
            4 => Some(&self.4),
            5 => Some(&self.5),
            6 => Some(&self.6),
            7 => Some(&self.7),
            _ => None,
        }
    }
}