pub use std::mem;
pub use std::slice;

pub enum IndexDatumType {
    UnsignedByte,
    UnsignedShort
}

pub trait IndexData {
    fn index_datum_type() -> IndexDatumType;
    fn index_bytes(&self) -> &[u8];
    fn index_elements(&self) -> usize;
}

pub trait IndexDatum {
    fn index_datum_type() -> IndexDatumType;
}

impl IndexDatum for u8 {
    fn index_datum_type() -> IndexDatumType { IndexDatumType::UnsignedByte }
}

impl IndexDatum for u16 {
    fn index_datum_type() -> IndexDatumType { IndexDatumType::UnsignedShort }
}

impl<T: IndexDatum> IndexData for [T] {
    fn index_datum_type() -> IndexDatumType {
        T::index_datum_type()
    }

    fn index_bytes(&self) -> &[u8] {
        let size = mem::size_of::<T>() * self.len();
        unsafe {
            slice::from_raw_parts(mem::transmute(&self[0]), size)
        }
    }

    fn index_elements(&self) -> usize {
        self.len()
    }
}

pub use std::mem;
pub use std::slice;

pub enum IndexDatumType {
    UnsignedByte,
    UnsignedShort
}

pub trait IndexData {
    fn index_datum_type() -> IndexDatumType;
    fn index_bytes(&self) -> &[u8];
    fn index_elements(&self) -> usize;
}

pub trait IndexDatum {
    fn index_datum_type() -> IndexDatumType;
}

impl IndexDatum for u8 {
    fn index_datum_type() -> IndexDatumType { IndexDatumType::UnsignedByte }
}

impl IndexDatum for u16 {
    fn index_datum_type() -> IndexDatumType { IndexDatumType::UnsignedShort }
}

--- 
+++ 
@@ -23,3 +23,20 @@
 impl IndexDatum for u16 {
     fn index_datum_type() -> IndexDatumType { IndexDatumType::UnsignedShort }
 }
+
+impl<T: IndexDatum> IndexData for [T] {
+    fn index_datum_type() -> IndexDatumType {
+        T::index_datum_type()
+    }
+
+    fn index_bytes(&self) -> &[u8] {
+        let size = mem::size_of::<T>() * self.len();
+        unsafe {
+            slice::from_raw_parts(mem::transmute(&self[0]), size)
+        }
+    }
+
+    fn index_elements(&self) -> usize {
+        self.len()
+    }
+}
Add impl of `IndexData` for arrays of `IndexDatum`s
