Merge pull request #280 from jgallagher/to-sql-str-u8

Add ToSql impls for str and [u8].
This commit is contained in:
John Gallagher 2017-05-29 13:39:35 -04:00 committed by GitHub
commit 20de96083a

View File

@ -94,12 +94,24 @@ impl ToSql for String {
} }
} }
impl ToSql for str {
fn to_sql(&self) -> Result<ToSqlOutput> {
Ok(ToSqlOutput::from(self))
}
}
impl ToSql for Vec<u8> { impl ToSql for Vec<u8> {
fn to_sql(&self) -> Result<ToSqlOutput> { fn to_sql(&self) -> Result<ToSqlOutput> {
Ok(ToSqlOutput::from(self.as_slice())) Ok(ToSqlOutput::from(self.as_slice()))
} }
} }
impl ToSql for [u8] {
fn to_sql(&self) -> Result<ToSqlOutput> {
Ok(ToSqlOutput::from(self))
}
}
impl ToSql for Value { impl ToSql for Value {
fn to_sql(&self) -> Result<ToSqlOutput> { fn to_sql(&self) -> Result<ToSqlOutput> {
Ok(ToSqlOutput::from(self)) Ok(ToSqlOutput::from(self))