-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impl Type
, Encode
, Decode
for AsRef<str>
#1347
Comments
This is not possible. The first impl would conflict with the other two: as far as the trait solver is concerned |
I see how the impls for |
Right, because the first impl is really for |
Got it, sorry for the noise. I'll create another issue for explicit |
I guess this could be revisited once specialization (rust-lang/rust#31844) is stabilized. |
Currently postgres'
Text
(and other db equivalents) is compatible with:&'_ str
String
[&'_ str]
[String]
Vec<&'_ str>
Vec<String>
Instead, I suggest implementing
Type
,Encode
&Decode
for:T: AsRef<str>
[T] where T: AsRef<str>
Vec<T> where T: AsRef<str>
This would simplify the code while allowing more types, such as
Box<str>
orCow<'_, str>
, to be used withText
.I haven't taken a look at other SQL types but this suggestion could apply there too.
Related:
The text was updated successfully, but these errors were encountered: