How can I implement a trait for type T that implements another trait?

I am writing a storage module for my app which has support for generic backends.
At the moment I am just implementing postgres backend.
I created a trait named ToDbVal which will be useful when I need to translate rust values to whatever driver counterpart value is.
So I want to implement ToDbVal for everything that is already postgres::types::ToSql
something like the following

impl ToDbVal for T:ToSql{
    fn to_db_val(&self)->Self::Output{
        ...
    }
}

Is this possible?

impl<T: ToSql> ToDbVal for T

or, equivalently,

impl<T> ToDbVal for T where T: ToSql
3 Likes

thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.