@@ -192,34 +192,33 @@ tuple_impl!(a: isize, b: isize, c: isize, d: isize, e: isize, f: isize, g: isize
192
192
tuple_impl ! ( a: isize , b: isize , c: isize , d: isize , e: isize , f: isize , g: isize , h: isize ) ;
193
193
tuple_impl ! ( a: isize , b: isize , c: isize , d: isize , e: isize , f: isize , g: isize , h: isize , i: isize ) ;
194
194
195
+ //github.com/ Indexes into the `Array`, retrieving a reference to the contained
196
+ //github.com/ value.
197
+ //github.com/
198
+ //github.com/ Since `Array`s can be multi-dimensional, the `Index` trait is
199
+ //github.com/ implemented for a variety of index types. In the most generic case, a
200
+ //github.com/ `&[isize]` can be used. In addition, a bare `isize` as well as tuples
201
+ //github.com/ of up to 10 `isize` values may be used for convenience.
202
+ //github.com/
203
+ //github.com/ # Panics
204
+ //github.com/
205
+ //github.com/ Panics if the index does not correspond to an in-bounds element of the
206
+ //github.com/ `Array`.
207
+ //github.com/
208
+ //github.com/ # Examples
209
+ //github.com/
210
+ //github.com/ ```rust
211
+ //github.com/ # use postgres_array::Array;
212
+ //github.com/ let mut array = Array::from_vec(vec![0i32, 1, 2, 3], 0);
213
+ //github.com/ assert_eq!(2, array[2]);
214
+ //github.com/
215
+ //github.com/ array.wrap(0);
216
+ //github.com/ array.push(Array::from_vec(vec![4, 5, 6, 7], 0));
217
+ //github.com/
218
+ //github.com/ assert_eq!(6, array[(1, 2)]);
219
+ //github.com/ ```
195
220
impl < T , I : ArrayIndex > Index < I > for Array < T > {
196
221
type Output = T ;
197
-
198
- //github.com/ Indexes into the `Array`, retrieving a reference to the contained
199
- //github.com/ value.
200
- //github.com/
201
- //github.com/ Since `Array`s can be multi-dimensional, the `Index` trait is
202
- //github.com/ implemented for a variety of index types. In the most generic case, a
203
- //github.com/ `&[isize]` can be used. In addition, a bare `isize` as well as tuples
204
- //github.com/ of up to 10 `isize` values may be used for convenience.
205
- //github.com/
206
- //github.com/ # Panics
207
- //github.com/
208
- //github.com/ Panics if the index does not correspond to an in-bounds element of the
209
- //github.com/ `Array`.
210
- //github.com/
211
- //github.com/ # Examples
212
- //github.com/
213
- //github.com/ ```rust
214
- //github.com/ # use postgres_array::Array;
215
- //github.com/ let mut array = Array::from_vec(vec![0i32, 1, 2, 3], 0);
216
- //github.com/ assert_eq!(2, array[2]);
217
- //github.com/
218
- //github.com/ array.wrap(0);
219
- //github.com/ array.push(Array::from_vec(vec![4, 5, 6, 7], 0));
220
- //github.com/
221
- //github.com/ assert_eq!(6, array[(1, 2)]);
222
- //github.com/ ```
223
222
fn index ( & self , idx : I ) -> & T {
224
223
let idx = idx. index ( self ) ;
225
224
& self . data [ idx]
0 commit comments