(&self, i: isize, vm: &VirtualMachine)
| 140 | } |
| 141 | |
| 142 | fn getitem_by_idx(&self, i: isize, vm: &VirtualMachine) -> PyResult { |
| 143 | if self.desc.ndim() != 1 { |
| 144 | return Err( |
| 145 | vm.new_not_implemented_error("multi-dimensional sub-views are not implemented") |
| 146 | ); |
| 147 | } |
| 148 | let (shape, stride, suboffset) = self.desc.dim_desc[0]; |
| 149 | let index = i |
| 150 | .wrapped_at(shape) |
| 151 | .ok_or_else(|| vm.new_index_error("index out of range"))?; |
| 152 | let index = index as isize * stride + suboffset; |
| 153 | let pos = (index + self.start as isize) as usize; |
| 154 | self.unpack_single(pos, vm) |
| 155 | } |
| 156 | |
| 157 | fn getitem_by_slice(&self, slice: &PySlice, vm: &VirtualMachine) -> PyResult { |
| 158 | let mut other = self.new_view(); |
no test coverage detected