Skip to content

Commit d2e78c6

Browse files
committed
Merge branch 'release-v0.6.0' into release
2 parents 1e55b21 + b681b0d commit d2e78c6

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

‎Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "postgres_array"
3-
version = "0.5.2"
3+
version = "0.6.0"
44
authors = ["Steven Fackler <[email protected]>"]
55
license = "MIT"
66
description = "Array support for rust-postgres"
77
repository = "https://github.com/sfackler/rust-postgres-array"
8-
documentation = "https://sfackler.github.io/rust-postgres-array/doc/v0.5.2/postgres_array"
8+
documentation = "https://sfackler.github.io/rust-postgres-array/doc/v0.6.0/postgres_array"
99

1010
[dependencies]
11-
postgres = ">= 0.9, < 0.11"
11+
postgres = "0.11"
1212
byteorder = ">= 0.3, < 0.5"
1313

1414
[dev-dependencies]

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# rust-postgres-array
22
[![Build Status](https://travis-ci.org/sfackler/rust-postgres-array.svg?branch=master)](https://travis-ci.org/sfackler/rust-postgres-array)
33

4-
[Documentation](https://sfackler.github.io/rust-postgres-array/doc/v0.5.2/postgres_array)
4+
[Documentation](https://sfackler.github.io/rust-postgres-array/doc/v0.6.0/postgres_array)
55

66
Support for PostgreSQL arrays in [rust-postgres](https://github.com/sfackler/rust-postgres).

‎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+
/// Indexes into the `Array`, retrieving a reference to the contained
196+
/// value.
197+
///
198+
/// Since `Array`s can be multi-dimensional, the `Index` trait is
199+
/// implemented for a variety of index types. In the most generic case, a
200+
/// `&[isize]` can be used. In addition, a bare `isize` as well as tuples
201+
/// of up to 10 `isize` values may be used for convenience.
202+
///
203+
/// # Panics
204+
///
205+
/// Panics if the index does not correspond to an in-bounds element of the
206+
/// `Array`.
207+
///
208+
/// # Examples
209+
///
210+
/// ```rust
211+
/// # use postgres_array::Array;
212+
/// let mut array = Array::from_vec(vec![0i32, 1, 2, 3], 0);
213+
/// assert_eq!(2, array[2]);
214+
///
215+
/// array.wrap(0);
216+
/// array.push(Array::from_vec(vec![4, 5, 6, 7], 0));
217+
///
218+
/// assert_eq!(6, array[(1, 2)]);
219+
/// ```
195220
impl<T,I:ArrayIndex>Index<I>forArray<T>{
196221
typeOutput = T;
197-
198-
/// Indexes into the `Array`, retrieving a reference to the contained
199-
/// value.
200-
///
201-
/// Since `Array`s can be multi-dimensional, the `Index` trait is
202-
/// implemented for a variety of index types. In the most generic case, a
203-
/// `&[isize]` can be used. In addition, a bare `isize` as well as tuples
204-
/// of up to 10 `isize` values may be used for convenience.
205-
///
206-
/// # Panics
207-
///
208-
/// Panics if the index does not correspond to an in-bounds element of the
209-
/// `Array`.
210-
///
211-
/// # Examples
212-
///
213-
/// ```rust
214-
/// # use postgres_array::Array;
215-
/// let mut array = Array::from_vec(vec![0i32, 1, 2, 3], 0);
216-
/// assert_eq!(2, array[2]);
217-
///
218-
/// array.wrap(0);
219-
/// array.push(Array::from_vec(vec![4, 5, 6, 7], 0));
220-
///
221-
/// assert_eq!(6, array[(1, 2)]);
222-
/// ```
223222
fnindex(&self,idx:I) -> &T{
224223
let idx = idx.index(self);
225224
&self.data[idx]

‎src/impls.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> FromSql for Array<Option<T>> where T: FromSql{
2121
let _element_type:Oid = try!(raw.read_u32::<BigEndian>());
2222

2323
letmut dim_info = Vec::with_capacity(ndim);
24-
for _ in(0..ndim){
24+
for _ in0..ndim {
2525
dim_info.push(Dimension{
2626
len: try!(raw.read_u32::<BigEndian>())asusize,
2727
lower_bound: try!(raw.read_i32::<BigEndian>())asisize,
@@ -34,7 +34,7 @@ impl<T> FromSql for Array<Option<T>> where T: FromSql{
3434
};
3535

3636
letmut elements = Vec::with_capacity(nele);
37-
for _ in(0..nele){
37+
for _ in0..nele {
3838
let len = try!(raw.read_i32::<BigEndian>());
3939
if len < 0{
4040
elements.push(None);
@@ -128,7 +128,7 @@ mod test{
128128
useArray;
129129

130130
fntest_type<T:PartialEq+FromSql+ToSql,S: fmt::Display>(sql_type:&str,checks:&[(T,S)]){
131-
let conn = Connection::connect("postgres://postgres@localhost",&SslMode::None).unwrap();
131+
let conn = Connection::connect("postgres://postgres@localhost",SslMode::None).unwrap();
132132
for&(ref val,ref repr)in checks.iter(){
133133
let stmt = conn.prepare(&format!("SELECT{}::{}",*repr, sql_type)).unwrap();
134134
let result = stmt.query(&[]).unwrap().iter().next().unwrap().get(0);
@@ -224,7 +224,7 @@ mod test{
224224

225225
#[test]
226226
fntest_empty_array(){
227-
let conn = Connection::connect("postgres://postgres@localhost",&SslMode::None).unwrap();
227+
let conn = Connection::connect("postgres://postgres@localhost",SslMode::None).unwrap();
228228
let stmt = conn.prepare("SELECT '{}'::INT4[]").unwrap();
229229
stmt.query(&[]).unwrap().iter().next().unwrap().get::<_,Array<Option<i32>>>(0);
230230
}

‎src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Multi-dimensional arrays with per-dimension specifiable lower bounds
2-
#![doc(html_root_url="https://sfackler.github.io/rust-postgres-array/doc/v0.5.2")]
2+
#![doc(html_root_url="https://sfackler.github.io/rust-postgres-array/doc/v0.6.0")]
33

44
#[macro_use(to_sql_checked)]
55
externcrate postgres;

0 commit comments

Comments
(0)