diesel/query_dsl/boxed_dsl.rs
1use query_builder::AsQuery;
2use query_source::Table;
3
4/// The `into_boxed` method
5///
6/// This trait should not be relied on directly by most apps. Its behavior is
7/// provided by [`QueryDsl`]. However, you may need a where clause on this trait
8/// to call `into_boxed` from generic code.
9///
10/// [`QueryDsl`]: ../trait.QueryDsl.html
11pub trait BoxedDsl<'a, DB> {
12 /// The return type of `internal_into_boxed`
13 type Output;
14
15 /// See the trait documentation.
16 fn internal_into_boxed(self) -> Self::Output;
17}
18
19impl<'a, T, DB> BoxedDsl<'a, DB> for T
20where
21 T: Table + AsQuery,
22 T::Query: BoxedDsl<'a, DB>,
23{
24 type Output = <T::Query as BoxedDsl<'a, DB>>::Output;
25
26 fn internal_into_boxed(self) -> Self::Output {
27 self.as_query().internal_into_boxed()
28 }
29}