Skip to main content

paginate_slice

Function paginate_slice 

Source
pub fn paginate_slice<T: Clone>(
    items: &[T],
    offset: usize,
    page_size: usize,
    mode: PaginationMode,
) -> Result<PaginationResult<T>, PaginationError>
Expand description

Paginate a slice, returning a page of items and an optional next-page cursor.

Returns PaginationResult with the page items, total count, and a base64-encoded cursor for the next page (or None if this is the last page).

ยงErrors

Returns PaginationError if cursor encoding fails.