pub enum Page {
Offset {
offset: usize,
limit: usize,
},
Cursor {
after: Option<String>,
size: usize,
},
}Expand description
Which page of a collection the client asked for.
JSON:API leaves pagination strategy to the implementation and only fixes
the page family of parameters. Both common strategies are supported, and
a request may use one or the other — never both:
- Offset —
?page[offset]=20&page[limit]=10. Givesfirst,prev,nextand, when storage reports a total,last. - Cursor —
?page[cursor]=t_20&page[size]=10. Stable while rows are being inserted, and the only sound choice on a large table, at the cost of nolastlink and no page count.
A List implementation matches on this. Storage that
only supports one strategy returns
ErrorCode::InvalidParameter for
the other rather than pretending.
Variants§
Offset
page[offset] / page[limit].
Fields
§
limit: usizeHow many to return, already clamped to MAX_PAGE_SIZE.
Cursor
page[cursor] / page[size].
Implementations§
Trait Implementations§
impl Eq for Page
impl StructuralPartialEq for Page
Auto Trait Implementations§
impl Freeze for Page
impl RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl UnsafeUnpin for Page
impl UnwindSafe for Page
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