File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 108
108
#![ doc( html_root_url = "https://docs.rs/postgres-types/0.1" ) ]
109
109
#![ warn( clippy:: all, rust_2018_idioms, missing_docs) ]
110
110
111
+ use crate :: sealed:: Sealed ;
111
112
use fallible_iterator:: FallibleIterator ;
112
113
use postgres_protocol:: types:: { self , ArrayDimension } ;
113
114
use std:: any:: type_name;
@@ -952,18 +953,29 @@ fn downcast(len: usize) -> Result<i32, Box<dyn Error + Sync + Send>> {
952
953
}
953
954
}
954
955
955
- /// A helper trait to be able create a parameters iterator from `&dyn ToSql` or `T: ToSql`
956
- pub trait BorrowToSql {
956
+ mod sealed {
957
+ pub trait Sealed { }
958
+ }
959
+
960
+ /// A helper trait used internally by Rust-Postgres
961
+ /// to be able create a parameters iterator from `&dyn ToSql` or `T: ToSql`.
962
+ ///
963
+ /// /// This cannot be implemented outside of this crate.
964
+ pub trait BorrowToSql : sealed:: Sealed {
957
965
/// Get a reference to a `ToSql` trait object
958
966
fn borrow_to_sql ( & self ) -> & dyn ToSql ;
959
967
}
960
968
969
+ impl Sealed for & dyn ToSql { }
970
+
961
971
impl BorrowToSql for & dyn ToSql {
962
972
fn borrow_to_sql ( & self ) -> & dyn ToSql {
963
973
* self
964
974
}
965
975
}
966
976
977
+ impl < T : ToSql > Sealed for T { }
978
+
967
979
impl < T : ToSql > BorrowToSql for T {
968
980
fn borrow_to_sql ( & self ) -> & dyn ToSql {
969
981
self
You can’t perform that action at this time.
0 commit comments