Skip to content

Commit 0993897

Browse files
committed
RunQueryDsl: match same trait constraints as diesel
This resolves issue #142 As it more closely matches the Ts that diesel::RunQueryDsl is implemented for as opposed to all Ts
1 parent e3beac6 commit 0993897

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/run_query_dsl/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub mod methods {
6666
/// to call `load` from generic code.
6767
///
6868
/// [`RunQueryDsl`]: super::RunQueryDsl
69-
pub trait LoadQuery<'query, Conn: AsyncConnection, U> {
69+
pub trait LoadQuery<'query, Conn: AsyncConnection, U> : RunQueryDsl<Conn> {
7070
/// The future returned by [`LoadQuery::internal_load`]
7171
type LoadFuture<'conn>: Future<Output = QueryResult<Self::Stream<'conn>>> + Send
7272
where
@@ -85,7 +85,7 @@ pub mod methods {
8585
Conn: AsyncConnection<Backend = DB>,
8686
U: Send,
8787
DB: Backend + 'static,
88-
T: AsQuery + Send + 'query,
88+
T: AsQuery + RunQueryDsl<Conn> + Send + 'query,
8989
T::Query: QueryFragment<DB> + QueryId + Send + 'query,
9090
T::SqlType: CompatibleType<U, DB, SqlType = ST>,
9191
U: FromSqlRow<ST, DB> + Send + 'static,
@@ -641,7 +641,9 @@ pub trait RunQueryDsl<Conn>: Sized {
641641
}
642642
}
643643

644-
impl<T, Conn> RunQueryDsl<Conn> for T {}
644+
// Note: Match the same types that diesel::RunQueryDsl applies to this
645+
// seems safe currently, as the trait imposes no restrictions based on Conn, only on T.
646+
impl <T,Conn> RunQueryDsl<Conn> for T where T: diesel::RunQueryDsl<Conn> {}
645647

646648
/// Sugar for types which implement both `AsChangeset` and `Identifiable`
647649
///

0 commit comments

Comments
 (0)