Remove another old workaround
This commit is contained in:
parent
2504aa504a
commit
4f0a5fa255
@ -2,7 +2,6 @@ use std::io::prelude::*;
|
|||||||
use byteorder::{WriteBytesExt, BigEndian};
|
use byteorder::{WriteBytesExt, BigEndian};
|
||||||
|
|
||||||
use Result;
|
use Result;
|
||||||
use error::Error;
|
|
||||||
use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast};
|
use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast};
|
||||||
|
|
||||||
/// An adapter type mapping slices to Postgres arrays.
|
/// An adapter type mapping slices to Postgres arrays.
|
||||||
@ -30,14 +29,6 @@ use types::{Type, ToSql, Kind, IsNull, SessionInfo, downcast};
|
|||||||
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
|
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
|
||||||
|
|
||||||
impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
|
impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
|
||||||
// FIXME should use to_sql_checked!() but blocked on rust-lang/rust#24308
|
|
||||||
fn to_sql_checked(&self, ty: &Type, out: &mut Write, ctx: &SessionInfo) -> Result<IsNull> {
|
|
||||||
if !<Slice<'a, T> as ToSql>::accepts(ty) {
|
|
||||||
return Err(Error::WrongType(ty.clone()));
|
|
||||||
}
|
|
||||||
self.to_sql(ty, out, ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_sql<W: Write + ?Sized>(&self,
|
fn to_sql<W: Write + ?Sized>(&self,
|
||||||
ty: &Type,
|
ty: &Type,
|
||||||
mut w: &mut W,
|
mut w: &mut W,
|
||||||
@ -76,4 +67,6 @@ impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
|
|||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
to_sql_checked!();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user