core_extensions 0.1.13

This crate provides many extensions to core/std library types.
Documentation
use super::{Cloned,IntoArray};
use super::cloned_items::*;

macro_rules! array_impls {
    (
        $( ( $size:expr,[$($elem:expr,)*] ) )*
    ) => (
        $(
            impl<'a,T> Cloned for [&'a T;$size] 
            where
                T: ?Sized + UsedCloneTrait
            {
                type Cloned=[ClonedType<T>;$size];

                fn cloned_(&self)->[ClonedType<T>;$size] {
                    [
                        $(clone_this(self[$elem]),)*
                    ]
                }
            }

            impl<T> IntoArray for [T;$size] {
                type Array=Self;

                fn into_array(self)->Self {
                    self
                }
            }


        )*
    )
}



/*

fn main() {
    let split_on=20;
    for i in 0..=32{
        print!("({0},[",i);
        let is_split=i >= split_on;
        for j in 0..i {
            if j%split_on==0 && is_split {
                print!("\n    ");
            }
            print!("{0},",j);
        }
        if is_split { println!() }
        println!("])");
    }
}

*/


array_impls!{
    (0,[])
    (1,[0,])
    (2,[0,1,])
    (3,[0,1,2,])
    (4,[0,1,2,3,])
    (5,[0,1,2,3,4,])
    (6,[0,1,2,3,4,5,])
    (7,[0,1,2,3,4,5,6,])
    (8,[0,1,2,3,4,5,6,7,])
    (9,[0,1,2,3,4,5,6,7,8,])
    (10,[0,1,2,3,4,5,6,7,8,9,])
    (11,[0,1,2,3,4,5,6,7,8,9,10,])
    (12,[0,1,2,3,4,5,6,7,8,9,10,11,])
    (13,[0,1,2,3,4,5,6,7,8,9,10,11,12,])
    (14,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,])
    (15,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,])
    (16,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,])
    (17,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,])
    (18,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,])
    (19,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,])
    (20,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
    ])
    (21,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,
    ])
    (22,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,
    ])
    (23,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,
    ])
    (24,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,
    ])
    (25,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,
    ])
    (26,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,
    ])
    (27,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,
    ])
    (28,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,27,
    ])
    (29,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,27,28,
    ])
    (30,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,27,28,29,
    ])
    (31,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,27,28,29,30,
    ])
    (32,[
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
        20,21,22,23,24,25,26,27,28,29,30,31,
    ])

}