-
Hello! I have an array wrapper type that is expected to be generic (it’s a simple wrapper around Vec). I can leverage the implementation of So for example I have the following definition: #[derive(FromSqlRow, AsExpression)]
#[diesel(sql_type=sql_types::Array<T>)]
pub struct UniqueVec<T: Hash + Eq> {
inner: Vec<T>,
} I know that the bound Right now this code: struct A {
v: UniqueVec<String>,
} fails with the following error:
Is there any way I can solve this ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The short answer is: You cannot solve this while using the derive and only using stable diesel API's. You can likely write the relevant impls on your own by relaying on the internals generated by the macro, but we don't guarantee that these API's exist in the next diesel version anymore. Tools like That written: On a conceptual level that would be something we might want to support at some point, but I don't have any good ideas how to describe the relevant information (mostly the "unbound" generic for the SQL type) for the derive. |
Beta Was this translation helpful? Give feedback.
The short answer is: You cannot solve this while using the derive and only using stable diesel API's. You can likely write the relevant impls on your own by relaying on the internals generated by the macro, but we don't guarantee that these API's exist in the next diesel version anymore. Tools like
cargo expand
or rust-analyzer let you expand macros. Such output then can be adjusted to your needs.That written: On a conceptual level that would be something we might want to support at some point, but I don't have any good ideas how to describe the relevant information (mostly the "unbound" generic for the SQL type) for the derive.