impl ToSql for Box<dyn ToSql>. Fixes #500

This commit is contained in:
Thom Chiovoloni
2019-03-27 16:46:54 -07:00
parent b24f3c5519
commit d8074b1ece
2 changed files with 19 additions and 0 deletions

View File

@@ -84,6 +84,13 @@ pub trait ToSql {
fn to_sql(&self) -> Result<ToSqlOutput<'_>>;
}
impl ToSql for Box<dyn ToSql> {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
let derefed: &dyn ToSql = &**self;
derefed.to_sql()
}
}
// We should be able to use a generic impl like this:
//
// impl<T: Copy> ToSql for T where T: Into<Value> {