Skip to content

Commit c5abe8c

Browse files
committed
Add ToSql impls for Vec
1 parent 5b646c0 commit c5abe8c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/types/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::io::{MemWriter, BufReader};
1111
use std::io::util::LimitReader;
1212
use std::str;
1313
use std::vec;
14+
use std::vec_ng::Vec;
1415
use time::Timespec;
1516

1617
use self::array::{Array, ArrayBase, DimensionInfo};
@@ -543,6 +544,12 @@ impl RawToSql for ~[u8] {
543544
}
544545
}
545546

547+
impl RawToSql for Vec<u8> {
548+
fn raw_to_sql<W: Writer>(&self, w: &mut W) {
549+
or_fail!(w.write(self.as_slice()))
550+
}
551+
}
552+
546553
impl RawToSql for ~str {
547554
fn raw_to_sql<W: Writer>(&self, w: &mut W) {
548555
or_fail!(w.write(self.as_bytes()))
@@ -677,6 +684,7 @@ macro_rules! to_raw_to_impl(
677684

678685
to_raw_to_impl!(PgBool, bool)
679686
to_raw_to_impl!(PgByteA, ~[u8])
687+
to_raw_to_impl!(PgByteA, Vec<u8>)
680688
to_raw_to_impl!(PgVarchar | PgText | PgCharN, ~str)
681689
to_raw_to_impl!(PgJson, Json)
682690
to_raw_to_impl!(PgChar, i8)
@@ -749,6 +757,7 @@ macro_rules! to_array_impl(
749757

750758
to_array_impl!(PgBoolArray, bool)
751759
to_array_impl!(PgByteAArray, ~[u8])
760+
to_array_impl!(PgByteAArray, Vec<u8>)
752761
to_array_impl!(PgCharArray, i8)
753762
to_array_impl!(PgInt2Array, i16)
754763
to_array_impl!(PgInt4Array, i32)

0 commit comments

Comments
 (0)