Pagination

Struct Pagination 

Source
pub struct Pagination {
    pub current_page: Option<u32>,
    pub total_pages: Option<u32>,
    pub prev_url: Option<String>,
    pub next_url: Option<String>,
    pub first_url: Option<String>,
    pub last_url: Option<String>,
    pub page_urls: Vec<PageUrl>,
    pub pagination_type: PaginationType,
    pub has_infinite_scroll: bool,
    pub has_load_more: bool,
    pub items_per_page: Option<u32>,
    pub total_items: Option<u32>,
}
Expand description

Pagination information for a page

Fields§

§current_page: Option<u32>

Current page number (if detected)

§total_pages: Option<u32>

Total pages (if detected)

§prev_url: Option<String>

Previous page URL (rel=“prev”)

§next_url: Option<String>

Next page URL (rel=“next”)

§first_url: Option<String>

First page URL

§last_url: Option<String>

Last page URL

§page_urls: Vec<PageUrl>

All detected page URLs with their numbers

§pagination_type: PaginationType

Pagination type detected

§has_infinite_scroll: bool

Whether infinite scroll is detected

§has_load_more: bool

Whether “load more” button is detected

§items_per_page: Option<u32>

Items per page (if detected)

§total_items: Option<u32>

Total items (if detected)

Implementations§

Source§

impl Pagination

Source

pub fn new() -> Self

Source

pub fn has_pagination(&self) -> bool

Check if pagination exists

Source

pub fn has_next(&self) -> bool

Check if there’s a next page

Source

pub fn has_prev(&self) -> bool

Check if there’s a previous page

Source

pub fn is_first_page(&self) -> bool

Check if this is the first page

Source

pub fn is_last_page(&self) -> bool

Check if this is the last page

Source

pub fn all_page_urls(&self) -> Vec<String>

Get all URLs to crawl for complete pagination

Trait Implementations§

Source§

impl Clone for Pagination

Source§

fn clone(&self) -> Pagination

Returns a duplicate 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 Pagination

Source§

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

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

impl Default for Pagination

Source§

fn default() -> Pagination

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Pagination

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Pagination

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Pagination

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Pagination

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,