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