Skip to content

Commit c40fc64

Browse files
committed
Reenable types::array
We really shouldn't need the 'static bound on T, but that can be fixed another day.
1 parent e362feb commit c40fc64

3 files changed

Lines changed: 8 additions & 18 deletions

File tree

src/types/array.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ impl<T> InternalMutableArray<T> for ArrayBase<T> {
201201
}
202202
}
203203

204-
enum ArrayParent<'parent, T:'parent> {
204+
enum ArrayParent<'parent, T:'static> {
205205
SliceParent(&'parent ArraySlice<'static, T>),
206206
MutSliceParent(&'parent MutArraySlice<'static, T>),
207207
BaseParent(&'parent ArrayBase<T>),
208208
}
209209

210210
/// An immutable slice of a multi-dimensional array
211-
pub struct ArraySlice<'parent, T:'parent> {
211+
pub struct ArraySlice<'parent, T:'static> {
212212
parent: ArrayParent<'parent, T>,
213213
idx: uint,
214214
}
@@ -253,13 +253,13 @@ impl<'parent, T> InternalArray<T> for ArraySlice<'parent, T> {
253253
}
254254
}
255255

256-
enum MutArrayParent<'parent, T> {
256+
enum MutArrayParent<'parent, T:'static> {
257257
MutSliceMutParent(&'parent mut MutArraySlice<'static, T>),
258258
MutBaseParent(&'parent mut ArrayBase<T>),
259259
}
260260

261261
/// A mutable slice of a multi-dimensional array
262-
pub struct MutArraySlice<'parent, T> {
262+
pub struct MutArraySlice<'parent, T:'static> {
263263
parent: MutArrayParent<'parent, T>,
264264
idx: uint,
265265
}

src/types/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use time::Timespec;
1010

1111
use PostgresResult;
1212
use error::{PgWrongType, PgStreamError, PgWasNull, PgBadData};
13-
//use types::array::{Array, ArrayBase, DimensionInfo};
13+
use types::array::{Array, ArrayBase, DimensionInfo};
1414
use types::range::{RangeBound, Inclusive, Exclusive, Range};
1515

16-
//pub mod array;
16+
pub mod array;
1717
pub mod range;
1818

1919
/// A Postgres OID
@@ -107,7 +107,6 @@ macro_rules! make_postgres_type(
107107
}
108108
}
109109

110-
/*
111110
fn member_type(&self) -> PostgresType {
112111
match *self {
113112
$(
@@ -116,7 +115,6 @@ macro_rules! make_postgres_type(
116115
_ => unreachable!()
117116
}
118117
}
119-
*/
120118
}
121119
)
122120
)
@@ -425,7 +423,6 @@ macro_rules! from_array_impl(
425423
)
426424
)
427425

428-
/*
429426
from_array_impl!(PgBoolArray, bool)
430427
from_array_impl!(PgByteAArray, Vec<u8>)
431428
from_array_impl!(PgCharArray, i8)
@@ -440,7 +437,6 @@ from_array_impl!(PgFloat8Array, f64)
440437
from_array_impl!(PgInt4RangeArray, Range<i32>)
441438
from_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
442439
from_array_impl!(PgInt8RangeArray, Range<i64>)
443-
*/
444440

445441
impl FromSql for Option<HashMap<String, Option<String>>> {
446442
fn from_sql(ty: &PostgresType, raw: &Option<Vec<u8>>)
@@ -730,7 +726,6 @@ macro_rules! to_array_impl(
730726
)
731727
)
732728

733-
/*
734729
to_array_impl!(PgBoolArray, bool)
735730
to_array_impl!(PgByteAArray, Vec<u8>)
736731
to_array_impl!(PgCharArray, i8)
@@ -745,7 +740,6 @@ to_array_impl!(PgInt4RangeArray, Range<i32>)
745740
to_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
746741
to_array_impl!(PgInt8RangeArray, Range<i64>)
747742
to_array_impl!(PgJsonArray, Json)
748-
*/
749743

750744
impl ToSql for HashMap<String, Option<String>> {
751745
fn to_sql(&self, ty: &PostgresType) -> PostgresResult<(Format, Option<Vec<u8>>)> {

tests/types/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use time;
66
use time::Timespec;
77

88
use postgres::{PostgresConnection, NoSsl};
9-
//use postgres::types::array::ArrayBase;
9+
use postgres::types::array::ArrayBase;
1010
use postgres::types::{ToSql, FromSql};
1111

12-
//mod array;
12+
mod array;
1313
mod range;
1414

1515
fn test_type<T: PartialEq+FromSql+ToSql, S: Str>(sql_type: &str, checks: &[(T, S)]) {
@@ -204,7 +204,6 @@ macro_rules! test_array_params(
204204
})
205205
)
206206

207-
/*
208207
#[test]
209208
fn test_boolarray_params() {
210209
test_array_params!("BOOL", false, "f", true, "t", true, "t");
@@ -315,7 +314,6 @@ fn test_int8rangearray_params() {
315314
range!('[' 10i64, ')'), "\"[10,)\"",
316315
range!('(', 10i64 ')'), "\"(,10)\"");
317316
}
318-
*/
319317

320318
#[test]
321319
fn test_hstore_params() {
@@ -359,7 +357,6 @@ fn test_f64_nan_param() {
359357
test_nan_param::<f64>("DOUBLE PRECISION");
360358
}
361359

362-
/*
363360
#[test]
364361
fn test_jsonarray_params() {
365362
test_array_params!("JSON",
@@ -370,7 +367,6 @@ fn test_jsonarray_params() {
370367
json::from_str(r#"{"a": [10], "b": true}"#).unwrap(),
371368
r#""{\"a\": [10], \"b\": true}""#);
372369
}
373-
*/
374370

375371
#[test]
376372
fn test_pg_database_datname() {

0 commit comments

Comments
 (0)