#![allow(dead_code, unused_imports)] #[macro_use] extern crate derive_more; #[derive(IndexMut)] struct MyVec(Vec); //Index implementation is required for IndexMut impl<__IdxT> ::core::ops::Index<__IdxT> for MyVec where Vec: ::core::ops::Index<__IdxT>, { type Output = as ::core::ops::Index<__IdxT>>::Output; #[inline] fn index(&self, idx: __IdxT) -> &Self::Output { as ::core::ops::Index<__IdxT>>::index(&self.0, idx) } } #[derive(IndexMut)] struct Numbers { #[index_mut] numbers: Vec, useless: bool, } //Index implementation is required for IndexMut impl<__IdxT> ::core::ops::Index<__IdxT> for Numbers where Vec: ::core::ops::Index<__IdxT>, { type Output = as ::core::ops::Index<__IdxT>>::Output; #[inline] fn index(&self, idx: __IdxT) -> &Self::Output { as ::core::ops::Index<__IdxT>>::index(&self.numbers, idx) } }