pub trait PaginatorTrait<'db, C>where
C: ConnectionTrait,{
type Selector: SelectorTrait + 'db;
// Required method
fn paginate(
self,
db: &'db C,
page_size: u64,
) -> Paginator<'db, C, Self::Selector>;
// Provided method
fn count(self, db: &'db C) -> Result<u64, DbErr>
where Self: Sized { ... }
}Expand description
Extension trait that adds .paginate(db, page_size) to anything
page-able — Select, SelectTwo,
Selector, SelectorRaw.
Required Associated Types§
Sourcetype Selector: SelectorTrait + 'db
type Selector: SelectorTrait + 'db
The SelectorTrait that materialises each row of the page.
Required Methods§
Provided Methods§
Sourcefn count(self, db: &'db C) -> Result<u64, DbErr>where
Self: Sized,
fn count(self, db: &'db C) -> Result<u64, DbErr>where
Self: Sized,
Count the number of rows this query selects, honoring any limit and
offset set on it.
This differs from Paginator::num_items, which resets limit/offset
to report the grand total for pagination. count wraps the query as-is in
a SELECT COUNT(*) FROM (..) subquery, so a query with a limit counts at
most that many rows.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".