pub struct PaginationCursor { /* private fields */ }Expand description
Bounded explicit cursor that locks page size and traversal metadata.
Implementations§
Source§impl PaginationCursor
impl PaginationCursor
Sourcepub const fn new(
first_page: PageNumber,
expected_per_page: u64,
limit: PageLimit,
) -> Result<Self, PaginationError>
pub const fn new( first_page: PageNumber, expected_per_page: u64, limit: PageLimit, ) -> Result<Self, PaginationError>
Starts a cursor with caller-bound page size and hard page limit.
Sourcepub const fn next_page(self) -> Result<PageNumber, PaginationError>
pub const fn next_page(self) -> Result<PageNumber, PaginationError>
Returns the page the caller must request next.
Sourcepub const fn pages_seen(self) -> u32
pub const fn pages_seen(self) -> u32
Returns the number of accepted pages.
Sourcepub fn observe(
&mut self,
metadata: PageMetadata,
entries: usize,
rate_limit: Option<RateLimit>,
) -> Result<PageBoundary, PaginationError>
pub fn observe( &mut self, metadata: PageMetadata, entries: usize, rate_limit: Option<RateLimit>, ) -> Result<PageBoundary, PaginationError>
Validates locked traversal metadata and decoded entries, then records the page.
Trait Implementations§
Source§impl Clone for PaginationCursor
impl Clone for PaginationCursor
Source§fn clone(&self) -> PaginationCursor
fn clone(&self) -> PaginationCursor
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 moreimpl Copy for PaginationCursor
Source§impl Debug for PaginationCursor
impl Debug for PaginationCursor
impl Eq for PaginationCursor
Source§impl PartialEq for PaginationCursor
impl PartialEq for PaginationCursor
impl StructuralPartialEq for PaginationCursor
Auto Trait Implementations§
impl Freeze for PaginationCursor
impl RefUnwindSafe for PaginationCursor
impl Send for PaginationCursor
impl Sync for PaginationCursor
impl Unpin for PaginationCursor
impl UnsafeUnpin for PaginationCursor
impl UnwindSafe for PaginationCursor
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