1mod budget;
4mod driver;
5mod link;
6mod local_async;
7mod numbered;
8mod offset;
9mod opaque;
10
11pub use budget::{
12 MAX_SNAPSHOT_ID_BYTES, PaginationBudget, PaginationLimits, PaginationProgress, SnapshotId,
13 SnapshotPolicy,
14};
15pub use driver::{PageStrategy, PagerControl, PagerDriver, PagerDriverError, PagerStep};
16pub use link::{ProviderLinkBinding, ProviderLinkExecutionError, ValidatedProviderLink};
17pub use numbered::{
18 NumberedPageBoundary, NumberedPageMetadata, NumberedPageObservation, NumberedPagination,
19 PageNumber,
20};
21pub use offset::{OffsetPageBoundary, OffsetPageMetadata, OffsetPageObservation, OffsetPagination};
22pub use opaque::{
23 CursorDigest, CursorHistory, MAX_OPAQUE_STATE_BYTES, PaginationCursor, PaginationMarker,
24};
25
26#[derive(Clone, Copy, Debug, Eq, PartialEq)]
28pub enum PaginationError {
29 ZeroLimit,
31 StateLimitTooLarge,
33 PageZero,
35 PageSizeZero,
37 InvalidPreviousPage,
39 InvalidNextPage,
41 InvalidLastPage,
43 UnexpectedPosition,
45 EmptyPageWithContinuation,
47 InvalidEntryCount,
49 PageSizeChanged,
51 TraversalChanged,
53 RequestBudgetExceeded,
55 ItemBudgetExceeded,
57 SnapshotRequired,
59 SnapshotIdEmpty,
61 SnapshotIdTooLong,
63 SnapshotForbidden,
65 SnapshotChanged,
67 Complete,
69 MissingState,
71 StateTooLong,
73 OutputTooSmall,
75 HistoryBudgetExceeded,
77 CursorCycle,
79 CursorDigestCollision,
81 CursorDigestChanged,
83 InvalidProviderLink,
85 ProviderLinkSchemeChanged,
87 ProviderLinkAuthorityChanged,
89 ProviderLinkUserinfo,
91 ProviderLinkFragment,
93 ProviderLinkPathChanged,
95 ProviderLinkMethodChanged,
97 ProviderLinkOperationChanged,
99}
100
101impl_static_error!(PaginationError,
102 Self::ZeroLimit => "pagination limits must be nonzero",
103 Self::StateLimitTooLarge => "opaque pagination state limit exceeds the hard limit",
104 Self::PageZero => "page number must be nonzero",
105 Self::PageSizeZero => "page size must be nonzero",
106 Self::InvalidPreviousPage => "previous-page metadata is invalid",
107 Self::InvalidNextPage => "next-page metadata is invalid",
108 Self::InvalidLastPage => "last-page metadata is invalid",
109 Self::UnexpectedPosition => "response position differs from the requested position",
110 Self::EmptyPageWithContinuation => "nonterminal response page is empty",
111 Self::InvalidEntryCount => "response entry count is invalid",
112 Self::PageSizeChanged => "response page size changed during traversal",
113 Self::TraversalChanged => "pagination metadata changed during traversal",
114 Self::RequestBudgetExceeded => "pagination request budget was exceeded",
115 Self::ItemBudgetExceeded => "pagination item budget was exceeded",
116 Self::SnapshotRequired => "provider snapshot identifier is required",
117 Self::SnapshotIdEmpty => "provider snapshot identifier is empty",
118 Self::SnapshotIdTooLong => "provider snapshot identifier exceeds the length limit",
119 Self::SnapshotForbidden => "provider snapshot identifier is forbidden",
120 Self::SnapshotChanged => "provider snapshot identifier changed during traversal",
121 Self::Complete => "pagination traversal is complete",
122 Self::MissingState => "opaque pagination state is missing",
123 Self::StateTooLong => "opaque pagination state exceeds the selected limit",
124 Self::OutputTooSmall => "pagination state output is too small",
125 Self::HistoryBudgetExceeded => "cursor history budget was exceeded",
126 Self::CursorCycle => "pagination cursor cycle was detected",
127 Self::CursorDigestCollision => "pagination cursor digest collision was detected",
128 Self::CursorDigestChanged => "pagination cursor digest changed for the same state",
129 Self::InvalidProviderLink => "provider pagination link is invalid",
130 Self::ProviderLinkSchemeChanged => "provider pagination link changed scheme",
131 Self::ProviderLinkAuthorityChanged => "provider pagination link changed authority",
132 Self::ProviderLinkUserinfo => "provider pagination link contains user information",
133 Self::ProviderLinkFragment => "provider pagination link contains a fragment",
134 Self::ProviderLinkPathChanged => "provider pagination link changed operation path",
135 Self::ProviderLinkMethodChanged => "provider pagination link changed HTTP method",
136 Self::ProviderLinkOperationChanged => "provider pagination link changed operation",
137);
138
139#[cfg(test)]
140mod tests;