Skip to main content

IntoRowCount

Trait IntoRowCount 

Source
pub trait IntoRowCount {
    // Required method
    fn into_row_count(self) -> RowCount;
}
Expand description

A number of rows — what a LIMIT and an OFFSET each are: an integer, or a prepare!{} placeholder for one, so a paginated endpoint can prepare its query once and vary the page. A trait rather than Into<i64> so a usize page size — the shape a paginated handler already has — goes in without a cast. Every numeric impl lands in 0..=i64::MAX: a negative count is not a query any database will run, and a usize past i64::MAX is not a page anyone is asking for.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoRowCount for i8

Source§

impl IntoRowCount for i16

Source§

impl IntoRowCount for i32

Source§

impl IntoRowCount for i64

Source§

impl IntoRowCount for isize

Source§

impl IntoRowCount for u8

Source§

impl IntoRowCount for u16

Source§

impl IntoRowCount for u32

Source§

impl IntoRowCount for u64

Source§

impl IntoRowCount for usize

Implementors§

Source§

impl IntoRowCount for Expr<Nil, BigInt>

Source§

impl IntoRowCount for Expr<Nil, Integer>

A prepare!{} placeholder, or any other scope-free Expr of an integer type: bound rather than written, so one prepared query serves every page. Only the two integer types — a page is a number.