Skip to content

Commit d9a8e26

Browse files
committed
Revert "Remove superfluous impls"
Turns out ~T won't actually autoborrow to &T when casting to a trait object. See rust-lang/rust#10347 This reverts commit c2a755d.
1 parent 8e41ccd commit d9a8e26

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

types/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,13 @@ to_option_impl!(PgFloat4, f32)
436436
to_conversions_impl!(PgFloat8, f64, write_be_f64)
437437
to_option_impl!(PgFloat8, f64)
438438

439+
impl ToSql for ~str {
440+
fn to_sql(&self, ty: PostgresType) -> (Format, Option<~[u8]>) {
441+
check_types!(PgVarchar | PgText | PgCharN, ty)
442+
(Text, Some(self.as_bytes().to_owned()))
443+
}
444+
}
445+
439446
impl<'self> ToSql for &'self str {
440447
fn to_sql(&self, ty: PostgresType) -> (Format, Option<~[u8]>) {
441448
check_types!(PgVarchar | PgText | PgCharN, ty)
@@ -446,6 +453,13 @@ impl<'self> ToSql for &'self str {
446453
to_option_impl!(PgVarchar | PgText | PgCharN, ~str)
447454
to_option_impl!(self, PgVarchar | PgText | PgCharN, &'self str)
448455

456+
impl ToSql for ~[u8] {
457+
fn to_sql(&self, ty: PostgresType) -> (Format, Option<~[u8]>) {
458+
check_types!(PgByteA, ty)
459+
(Binary, Some(self.to_owned()))
460+
}
461+
}
462+
449463
impl<'self> ToSql for &'self [u8] {
450464
fn to_sql(&self, ty: PostgresType) -> (Format, Option<~[u8]>) {
451465
check_types!(PgByteA, ty)

0 commit comments

Comments
 (0)