/// Contains type-specialized versions of /// /// ``` /// impl Index for [T; N] /// where /// [T]: Index, /// { /// type Output = <[T] as Index>::Output; /// ... /// } /// ``` /// /// and /// /// ``` /// impl ops::Index for [T] /// where /// I: SliceIndex<[T]>, /// { /// type Output = I::Output; /// ... /// } /// ``` /// /// and /// ``` /// impl, A: Allocator> Index for Vec { /// type Output = I::Output; /// ... /// } /// ``` /// /// (as well as their `IndexMut` counterparts), which the type inference library /// cannot currently handle (we fail to resolve the `Output` types). mod index_impls { use std::alloc::Allocator; use std::ops::Index; impl Index for [T; N] { type Output = T; fn index(&self, index: i32) -> &Self::Output { panic!() } } impl IndexMut for [T; N] { type Output = T; fn index_mut(&mut self, index: i32) -> &mut Self::Output { panic!() } } impl Index for [T; N] { type Output = T; fn index(&self, index: usize) -> &Self::Output { panic!() } } impl IndexMut for [T; N] { type Output = T; fn index_mut(&mut self, index: usize) -> &mut Self::Output { panic!() } } impl Index for [T] { type Output = T; fn index(&self, index: i32) -> &Self::Output { panic!() } } impl IndexMut for [T] { type Output = T; fn index_mut(&mut self, index: i32) -> &mut Self::Output { panic!() } } impl Index for [T] { type Output = T; fn index(&self, index: usize) -> &Self::Output { panic!() } } impl IndexMut for [T] { type Output = T; fn index_mut(&mut self, index: usize) -> &mut Self::Output { panic!() } } impl Index for Vec { type Output = T; fn index(&self, index: i32) -> &Self::Output { panic!() } } impl IndexMut for Vec { type Output = T; fn index_mut(&mut self, index: i32) -> &mut Self::Output { panic!() } } impl Index for Vec { type Output = T; fn index(&self, index: usize) -> &Self::Output { panic!() } } impl IndexMut for Vec { type Output = T; fn index_mut(&mut self, index: usize) -> &mut Self::Output { panic!() } } }