Skip to content

Commit a379fbb

Browse files
committed
impl ToStatement for String → impl<T: Sealed + AsRef<str>> ToStatement for T
1 parent 490c485 commit a379fbb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tokio-postgres/src/to_statement.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use crate::to_statement::private::{Sealed, ToStatementType};
2-
use crate::Statement;
1+
use crate::{
2+
to_statement::private::{Sealed, ToStatementType},
3+
Statement,
4+
};
35

46
mod private {
57
use crate::{Client, Error, Statement};
@@ -47,10 +49,11 @@ impl ToStatement for str {
4749
}
4850

4951
impl Sealed for str {}
52+
impl Sealed for &str {}
5053

51-
impl ToStatement for String {
54+
impl<T: Sealed + AsRef<str>> ToStatement for T {
5255
fn __convert(&self) -> ToStatementType<'_> {
53-
ToStatementType::Query(self)
56+
ToStatementType::Query(self.as_ref())
5457
}
5558
}
5659

0 commit comments

Comments
 (0)