Reenable types::array

We really shouldn't need the 'static bound on T, but that can be fixed
another day.
This commit is contained in:
Steven Fackler 2014-09-11 21:40:52 -07:00
parent e362feb85b
commit c40fc64197
3 changed files with 8 additions and 18 deletions

View File

@ -201,14 +201,14 @@ impl<T> InternalMutableArray<T> for ArrayBase<T> {
}
}
enum ArrayParent<'parent, T:'parent> {
enum ArrayParent<'parent, T:'static> {
SliceParent(&'parent ArraySlice<'static, T>),
MutSliceParent(&'parent MutArraySlice<'static, T>),
BaseParent(&'parent ArrayBase<T>),
}
/// An immutable slice of a multi-dimensional array
pub struct ArraySlice<'parent, T:'parent> {
pub struct ArraySlice<'parent, T:'static> {
parent: ArrayParent<'parent, T>,
idx: uint,
}
@ -253,13 +253,13 @@ impl<'parent, T> InternalArray<T> for ArraySlice<'parent, T> {
}
}
enum MutArrayParent<'parent, T> {
enum MutArrayParent<'parent, T:'static> {
MutSliceMutParent(&'parent mut MutArraySlice<'static, T>),
MutBaseParent(&'parent mut ArrayBase<T>),
}
/// A mutable slice of a multi-dimensional array
pub struct MutArraySlice<'parent, T> {
pub struct MutArraySlice<'parent, T:'static> {
parent: MutArrayParent<'parent, T>,
idx: uint,
}

View File

@ -10,10 +10,10 @@ use time::Timespec;
use PostgresResult;
use error::{PgWrongType, PgStreamError, PgWasNull, PgBadData};
//use types::array::{Array, ArrayBase, DimensionInfo};
use types::array::{Array, ArrayBase, DimensionInfo};
use types::range::{RangeBound, Inclusive, Exclusive, Range};
//pub mod array;
pub mod array;
pub mod range;
/// A Postgres OID
@ -107,7 +107,6 @@ macro_rules! make_postgres_type(
}
}
/*
fn member_type(&self) -> PostgresType {
match *self {
$(
@ -116,7 +115,6 @@ macro_rules! make_postgres_type(
_ => unreachable!()
}
}
*/
}
)
)
@ -425,7 +423,6 @@ macro_rules! from_array_impl(
)
)
/*
from_array_impl!(PgBoolArray, bool)
from_array_impl!(PgByteAArray, Vec<u8>)
from_array_impl!(PgCharArray, i8)
@ -440,7 +437,6 @@ from_array_impl!(PgFloat8Array, f64)
from_array_impl!(PgInt4RangeArray, Range<i32>)
from_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
from_array_impl!(PgInt8RangeArray, Range<i64>)
*/
impl FromSql for Option<HashMap<String, Option<String>>> {
fn from_sql(ty: &PostgresType, raw: &Option<Vec<u8>>)
@ -730,7 +726,6 @@ macro_rules! to_array_impl(
)
)
/*
to_array_impl!(PgBoolArray, bool)
to_array_impl!(PgByteAArray, Vec<u8>)
to_array_impl!(PgCharArray, i8)
@ -745,7 +740,6 @@ to_array_impl!(PgInt4RangeArray, Range<i32>)
to_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
to_array_impl!(PgInt8RangeArray, Range<i64>)
to_array_impl!(PgJsonArray, Json)
*/
impl ToSql for HashMap<String, Option<String>> {
fn to_sql(&self, ty: &PostgresType) -> PostgresResult<(Format, Option<Vec<u8>>)> {

View File

@ -6,10 +6,10 @@ use time;
use time::Timespec;
use postgres::{PostgresConnection, NoSsl};
//use postgres::types::array::ArrayBase;
use postgres::types::array::ArrayBase;
use postgres::types::{ToSql, FromSql};
//mod array;
mod array;
mod range;
fn test_type<T: PartialEq+FromSql+ToSql, S: Str>(sql_type: &str, checks: &[(T, S)]) {
@ -204,7 +204,6 @@ macro_rules! test_array_params(
})
)
/*
#[test]
fn test_boolarray_params() {
test_array_params!("BOOL", false, "f", true, "t", true, "t");
@ -315,7 +314,6 @@ fn test_int8rangearray_params() {
range!('[' 10i64, ')'), "\"[10,)\"",
range!('(', 10i64 ')'), "\"(,10)\"");
}
*/
#[test]
fn test_hstore_params() {
@ -359,7 +357,6 @@ fn test_f64_nan_param() {
test_nan_param::<f64>("DOUBLE PRECISION");
}
/*
#[test]
fn test_jsonarray_params() {
test_array_params!("JSON",
@ -370,7 +367,6 @@ fn test_jsonarray_params() {
json::from_str(r#"{"a": [10], "b": true}"#).unwrap(),
r#""{\"a\": [10], \"b\": true}""#);
}
*/
#[test]
fn test_pg_database_datname() {