From c5abe8c0d757dc5f64ed1f4dafb8ab59c87e69f4 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 14 Mar 2014 23:01:46 -0700 Subject: [PATCH] Add ToSql impls for Vec --- src/types/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/types/mod.rs b/src/types/mod.rs index 0676a722..c67dfb15 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -11,6 +11,7 @@ use std::io::{MemWriter, BufReader}; use std::io::util::LimitReader; use std::str; use std::vec; +use std::vec_ng::Vec; use time::Timespec; use self::array::{Array, ArrayBase, DimensionInfo}; @@ -543,6 +544,12 @@ impl RawToSql for ~[u8] { } } +impl RawToSql for Vec { + fn raw_to_sql(&self, w: &mut W) { + or_fail!(w.write(self.as_slice())) + } +} + impl RawToSql for ~str { fn raw_to_sql(&self, w: &mut W) { or_fail!(w.write(self.as_bytes())) @@ -677,6 +684,7 @@ macro_rules! to_raw_to_impl( to_raw_to_impl!(PgBool, bool) to_raw_to_impl!(PgByteA, ~[u8]) +to_raw_to_impl!(PgByteA, Vec) to_raw_to_impl!(PgVarchar | PgText | PgCharN, ~str) to_raw_to_impl!(PgJson, Json) to_raw_to_impl!(PgChar, i8) @@ -749,6 +757,7 @@ macro_rules! to_array_impl( to_array_impl!(PgBoolArray, bool) to_array_impl!(PgByteAArray, ~[u8]) +to_array_impl!(PgByteAArray, Vec) to_array_impl!(PgCharArray, i8) to_array_impl!(PgInt2Array, i16) to_array_impl!(PgInt4Array, i32)