pub struct Pagination {
pub current_page: 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
分页信息
表示从 HTML 文档中提取的完整分页导航信息。
Fields§
§current_page: u32当前页码
total_pages: Option<u32>总页数(部分分页模式可能无法获取)
prev_url: Option<String>上一页 URL
next_url: Option<String>下一页 URL
first_url: Option<String>第一页 URL
last_url: Option<String>最后一页 URL
page_urls: Vec<PageUrl>所有分页链接列表
pagination_type: PaginationType分页类型
has_infinite_scroll: bool是否使用无限滚动
has_load_more: bool是否使用「加载更多」
items_per_page: Option<u32>每页条目数(如可推断)
total_items: Option<u32>总条目数(如可获取)
Implementations§
Source§impl Pagination
impl Pagination
Sourcepub fn has_pagination(&self) -> bool
pub fn has_pagination(&self) -> bool
判断该页面是否有分页导航
Sourcepub fn next_page_url(&self) -> Option<&str>
pub fn next_page_url(&self) -> Option<&str>
返回下一页的 URL
Sourcepub fn prev_page_url(&self) -> Option<&str>
pub fn prev_page_url(&self) -> Option<&str>
返回上一页的 URL
Sourcepub fn numbered_pages(&self) -> Vec<&PageUrl>
pub fn numbered_pages(&self) -> Vec<&PageUrl>
获取所有数字分页链接(排除上一页/下一页)
Trait Implementations§
Source§impl Clone for Pagination
impl Clone for Pagination
Source§fn clone(&self) -> Pagination
fn clone(&self) -> Pagination
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Pagination
impl Debug for Pagination
Source§impl Default for Pagination
impl Default for Pagination
Source§impl<'de> Deserialize<'de> for Pagination
impl<'de> Deserialize<'de> for Pagination
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Pagination
impl RefUnwindSafe for Pagination
impl Send for Pagination
impl Sync for Pagination
impl Unpin for Pagination
impl UnsafeUnpin for Pagination
impl UnwindSafe for Pagination
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more