fn new_inner(items: u64, per_page: u64, current_page: NonZeroU64) -> Option<Self> {
        // Calculate the number of pages required.
        let pages_required: u64 = items / per_page + 1;

        if pages_required <= 1 {
            // No pagination if there is only one page.
            None
        } else {
            Some(PaginationInfo {
                // include left separator if there are pages between
                left_sep: (current_page.get() - 1) > 2,

                // If we're currently on the first page this will be hidden.
                prev: current_page.get() - 1,

                current: current_page,

                // If we're currently on the last page this will be hidden.
                next: current_page.get() + 1,

                // similar with right separator,
                right_sep: current_page.get() + 1 < pages_required - 1,

                last: pages_required,
            })
        }
    }
/// Create a new pagination info object if there are enough results to
/// require multiple pages.
Create a new pagination info object if there are enough results to
require multiple pages.
Create a new pagination info object if there are enough results to require multiple pages .
fn new_inner(items: u64, per_page: u64, current_page: NonZeroU64) -> Option<Self> {
        // Calculate the number of pages required.
        let pages_required: u64 = items / per_page + 1;
        if pages_required <= 1 {
            // No pagination if there is only one page.
            None
        } else {
            Some(PaginationInfo {
                // include left separator if there are pages between
                left_sep: (current_page.get() - 1) > 2,
                // If we're currently on the first page this will be hidden.
                prev: current_page.get() - 1,
                current: current_page,
                // If we're currently on the last page this will be hidden.
                next: current_page.get() + 1,
                // similar with right separator,
                right_sep: current_page.get() + 1 < pages_required - 1,
                last: pages_required,
            })
        }
    }
fn new_inner ( items : u64 , per_page : u64 , current_page : NonZeroU64 ) -> Option < Self > { // Calculate the number of pages required. let pages_required : u64 = items / per_page + 1 ; if pages_required <= 1 { // No pagination if there is only one page. None } else { Some ( PaginationInfo { // include left separator if there are pages between left_sep : ( current_page . get ( ) - 1 ) > 2 , // If we're currently on the first page this will be hidden. prev : current_page . get ( ) - 1 , current : current_page , // If we're currently on the last page this will be hidden. next : current_page . get ( ) + 1 , // similar with right separator, right_sep : current_page . get ( ) + 1 < pages_required - 1 , last : pages_required , } ) } }
Create a new pagination info object if there are enough results to
require multiple pages.
Create a new pagination info object if there are enough results to require multiple pages .
items
u64
per_page
u64
current_page
NonZeroU64
items
u64
per_page
u64
current_page
NonZeroU64