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:
parent
e362feb85b
commit
c40fc64197
@ -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>),
|
SliceParent(&'parent ArraySlice<'static, T>),
|
||||||
MutSliceParent(&'parent MutArraySlice<'static, T>),
|
MutSliceParent(&'parent MutArraySlice<'static, T>),
|
||||||
BaseParent(&'parent ArrayBase<T>),
|
BaseParent(&'parent ArrayBase<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An immutable slice of a multi-dimensional array
|
/// An immutable slice of a multi-dimensional array
|
||||||
pub struct ArraySlice<'parent, T:'parent> {
|
pub struct ArraySlice<'parent, T:'static> {
|
||||||
parent: ArrayParent<'parent, T>,
|
parent: ArrayParent<'parent, T>,
|
||||||
idx: uint,
|
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>),
|
MutSliceMutParent(&'parent mut MutArraySlice<'static, T>),
|
||||||
MutBaseParent(&'parent mut ArrayBase<T>),
|
MutBaseParent(&'parent mut ArrayBase<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A mutable slice of a multi-dimensional array
|
/// A mutable slice of a multi-dimensional array
|
||||||
pub struct MutArraySlice<'parent, T> {
|
pub struct MutArraySlice<'parent, T:'static> {
|
||||||
parent: MutArrayParent<'parent, T>,
|
parent: MutArrayParent<'parent, T>,
|
||||||
idx: uint,
|
idx: uint,
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@ use time::Timespec;
|
|||||||
|
|
||||||
use PostgresResult;
|
use PostgresResult;
|
||||||
use error::{PgWrongType, PgStreamError, PgWasNull, PgBadData};
|
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};
|
use types::range::{RangeBound, Inclusive, Exclusive, Range};
|
||||||
|
|
||||||
//pub mod array;
|
pub mod array;
|
||||||
pub mod range;
|
pub mod range;
|
||||||
|
|
||||||
/// A Postgres OID
|
/// A Postgres OID
|
||||||
@ -107,7 +107,6 @@ macro_rules! make_postgres_type(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
fn member_type(&self) -> PostgresType {
|
fn member_type(&self) -> PostgresType {
|
||||||
match *self {
|
match *self {
|
||||||
$(
|
$(
|
||||||
@ -116,7 +115,6 @@ macro_rules! make_postgres_type(
|
|||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -425,7 +423,6 @@ macro_rules! from_array_impl(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
|
||||||
from_array_impl!(PgBoolArray, bool)
|
from_array_impl!(PgBoolArray, bool)
|
||||||
from_array_impl!(PgByteAArray, Vec<u8>)
|
from_array_impl!(PgByteAArray, Vec<u8>)
|
||||||
from_array_impl!(PgCharArray, i8)
|
from_array_impl!(PgCharArray, i8)
|
||||||
@ -440,7 +437,6 @@ from_array_impl!(PgFloat8Array, f64)
|
|||||||
from_array_impl!(PgInt4RangeArray, Range<i32>)
|
from_array_impl!(PgInt4RangeArray, Range<i32>)
|
||||||
from_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
|
from_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
|
||||||
from_array_impl!(PgInt8RangeArray, Range<i64>)
|
from_array_impl!(PgInt8RangeArray, Range<i64>)
|
||||||
*/
|
|
||||||
|
|
||||||
impl FromSql for Option<HashMap<String, Option<String>>> {
|
impl FromSql for Option<HashMap<String, Option<String>>> {
|
||||||
fn from_sql(ty: &PostgresType, raw: &Option<Vec<u8>>)
|
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!(PgBoolArray, bool)
|
||||||
to_array_impl!(PgByteAArray, Vec<u8>)
|
to_array_impl!(PgByteAArray, Vec<u8>)
|
||||||
to_array_impl!(PgCharArray, i8)
|
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!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
|
||||||
to_array_impl!(PgInt8RangeArray, Range<i64>)
|
to_array_impl!(PgInt8RangeArray, Range<i64>)
|
||||||
to_array_impl!(PgJsonArray, Json)
|
to_array_impl!(PgJsonArray, Json)
|
||||||
*/
|
|
||||||
|
|
||||||
impl ToSql for HashMap<String, Option<String>> {
|
impl ToSql for HashMap<String, Option<String>> {
|
||||||
fn to_sql(&self, ty: &PostgresType) -> PostgresResult<(Format, Option<Vec<u8>>)> {
|
fn to_sql(&self, ty: &PostgresType) -> PostgresResult<(Format, Option<Vec<u8>>)> {
|
||||||
|
@ -6,10 +6,10 @@ use time;
|
|||||||
use time::Timespec;
|
use time::Timespec;
|
||||||
|
|
||||||
use postgres::{PostgresConnection, NoSsl};
|
use postgres::{PostgresConnection, NoSsl};
|
||||||
//use postgres::types::array::ArrayBase;
|
use postgres::types::array::ArrayBase;
|
||||||
use postgres::types::{ToSql, FromSql};
|
use postgres::types::{ToSql, FromSql};
|
||||||
|
|
||||||
//mod array;
|
mod array;
|
||||||
mod range;
|
mod range;
|
||||||
|
|
||||||
fn test_type<T: PartialEq+FromSql+ToSql, S: Str>(sql_type: &str, checks: &[(T, S)]) {
|
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]
|
#[test]
|
||||||
fn test_boolarray_params() {
|
fn test_boolarray_params() {
|
||||||
test_array_params!("BOOL", false, "f", true, "t", true, "t");
|
test_array_params!("BOOL", false, "f", true, "t", true, "t");
|
||||||
@ -315,7 +314,6 @@ fn test_int8rangearray_params() {
|
|||||||
range!('[' 10i64, ')'), "\"[10,)\"",
|
range!('[' 10i64, ')'), "\"[10,)\"",
|
||||||
range!('(', 10i64 ')'), "\"(,10)\"");
|
range!('(', 10i64 ')'), "\"(,10)\"");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hstore_params() {
|
fn test_hstore_params() {
|
||||||
@ -359,7 +357,6 @@ fn test_f64_nan_param() {
|
|||||||
test_nan_param::<f64>("DOUBLE PRECISION");
|
test_nan_param::<f64>("DOUBLE PRECISION");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_jsonarray_params() {
|
fn test_jsonarray_params() {
|
||||||
test_array_params!("JSON",
|
test_array_params!("JSON",
|
||||||
@ -370,7 +367,6 @@ fn test_jsonarray_params() {
|
|||||||
json::from_str(r#"{"a": [10], "b": true}"#).unwrap(),
|
json::from_str(r#"{"a": [10], "b": true}"#).unwrap(),
|
||||||
r#""{\"a\": [10], \"b\": true}""#);
|
r#""{\"a\": [10], \"b\": true}""#);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pg_database_datname() {
|
fn test_pg_database_datname() {
|
||||||
|
Loading…
Reference in New Issue
Block a user