pub struct PaginatorBuilder {
    pub total_pages: usize,
    pub current_page: usize,
    pub max_item_count: usize,
    pub start_size: usize,
    pub end_size: usize,
    pub has_prev: YesNoDepends,
    pub has_next: YesNoDepends,
}
Expand description

A struct to create Paginator or PaginatorIter.

Fields§

§total_pages: usize

The number of pages.

§current_page: usize

The number of the current page.

§max_item_count: usize

The max number of PageItems after generated.

§start_size: usize

The number of PageItems (the PageItem::Prev item is excluded) on the start edge (before the first PageItem::Ignore item).

§end_size: usize

The number of PageItems (the PageItem::Next item is excluded) on the end edge (after the last PageItem::Ignore item).

§has_prev: YesNoDepends

Whether to add the PageItem::Prev item.

§has_next: YesNoDepends

Whether to add the PageItem::Next item.

Implementations§

source§

impl PaginatorBuilder

source

pub const fn new(total_pages: usize) -> PaginatorBuilder

Create a new PaginatorBuilder with some default options.

PaginatorBuilder {
    total_pages, // this is input by the caller.
    current_page: 1,
    max_item_count: 9,
    start_size: 1,
    end_size: 1,
    has_prev: YesNoDepends::Depends,
    has_next: YesNoDepends::Depends,
}
source

pub const fn total_pages(self, total_pages: usize) -> PaginatorBuilder

Set the number of pages.

source

pub const fn current_page(self, current_page: usize) -> PaginatorBuilder

Set the number of the current page.

source

pub const fn max_item_count(self, max_item_count: usize) -> PaginatorBuilder

Set the max number of PageItems after generated.

source

pub const fn start_size(self, start_size: usize) -> PaginatorBuilder

Set the number of PageItems (the PageItem::Prev item is excluded) on the start edge (before the first PageItem::Ignore item).

source

pub const fn end_size(self, end_size: usize) -> PaginatorBuilder

Set the number of PageItems (the PageItem::Next item is excluded) on the end edge (after the last PageItem::Ignore item).

source

pub const fn has_prev(self, has_prev: YesNoDepends) -> PaginatorBuilder

Set whether to add the PageItem::Prev item.

source

pub const fn has_next(self, has_next: YesNoDepends) -> PaginatorBuilder

Set whether to add the PageItem::Next item.

source§

impl PaginatorBuilder

Trait Implementations§

source§

impl Clone for PaginatorBuilder

source§

fn clone(&self) -> PaginatorBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PaginatorBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<PaginatorBuilder> for PaginatorBuilder

source§

fn eq(&self, other: &PaginatorBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PaginatorBuilder

source§

impl StructuralEq for PaginatorBuilder

source§

impl StructuralPartialEq for PaginatorBuilder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.