pub struct NumberedPagination { /* private fields */ }Expand description
Stateful numbered-page strategy with locked traversal metadata.
This type is intentionally neither Copy nor Clone.
Implementations§
Source§impl NumberedPagination
impl NumberedPagination
Sourcepub fn new(
first_page: PageNumber,
expected_page_size: u64,
budget: PaginationBudget,
) -> Result<Self, PaginationError>
pub fn new( first_page: PageNumber, expected_page_size: u64, budget: PaginationBudget, ) -> Result<Self, PaginationError>
Starts a numbered traversal.
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 progress(&self) -> PaginationProgress
pub const fn progress(&self) -> PaginationProgress
Returns accepted counters.
Sourcepub fn observe(
&mut self,
metadata: NumberedPageMetadata,
entries: usize,
rate_limit: Option<RateLimit>,
snapshot: Option<SnapshotId<'_>>,
) -> Result<NumberedPageBoundary, PaginationError>
pub fn observe( &mut self, metadata: NumberedPageMetadata, entries: usize, rate_limit: Option<RateLimit>, snapshot: Option<SnapshotId<'_>>, ) -> Result<NumberedPageBoundary, PaginationError>
Validates one response transactionally, then advances the strategy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NumberedPagination
impl RefUnwindSafe for NumberedPagination
impl Send for NumberedPagination
impl Sync for NumberedPagination
impl Unpin for NumberedPagination
impl UnsafeUnpin for NumberedPagination
impl UnwindSafe for NumberedPagination
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