From aa6c542202207b3fa2928c6eabddd5dbf4ae2115 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 23 Jan 2017 19:42:02 -0500 Subject: [PATCH] Add impl ToSql for ToSqlOutput. --- src/types/to_sql.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/types/to_sql.rs b/src/types/to_sql.rs index 3738217..9dfa6b9 100644 --- a/src/types/to_sql.rs +++ b/src/types/to_sql.rs @@ -28,6 +28,18 @@ impl<'a, T: Into> From for ToSqlOutput<'a> { } } +impl<'a> ToSql for ToSqlOutput<'a> { + fn to_sql(&self) -> Result { + Ok(match *self { + ToSqlOutput::Borrowed(v) => ToSqlOutput::Borrowed(v), + ToSqlOutput::Owned(ref v) => ToSqlOutput::Borrowed(ValueRef::from(v)), + + #[cfg(feature = "blob")] + ToSqlOutput::ZeroBlob(i) => ToSqlOutput::ZeroBlob(i), + }) + } +} + /// A trait for types that can be converted into SQLite values. pub trait ToSql { fn to_sql(&self) -> Result;