Content-Length: 352343 | pFad | http://github.com/psqlpy-python/rust-postgres-array/commit/11921b836ee7b5534558ead84f221b010d7c9a6b

B6 Make Index docs actually render · psqlpy-python/rust-postgres-array@11921b8 · GitHub
Skip to content

Commit 11921b8

Browse files
committed
Make Index docs actually render
1 parent 801d641 commit 11921b8

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

src/array.rs

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -192,34 +192,33 @@ tuple_impl!(a: isize, b: isize, c: isize, d: isize, e: isize, f: isize, g: isize
192192
tuple_impl!(a: isize, b: isize, c: isize, d: isize, e: isize, f: isize, g: isize, h: isize);
193193
tuple_impl!(a: isize, b: isize, c: isize, d: isize, e: isize, f: isize, g: isize, h: isize, i: isize);
194194

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/ ```
195220
impl<T, I: ArrayIndex> Index<I> for Array<T> {
196221
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/ ```
223222
fn index(&self, idx: I) -> &T {
224223
let idx = idx.index(self);
225224
&self.data[idx]

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/psqlpy-python/rust-postgres-array/commit/11921b836ee7b5534558ead84f221b010d7c9a6b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy