[−][src]Struct dropshot::PaginationParams
Querystring parameters provided by clients when scanning a paginated collection
To build an API endpoint that paginates results, you have your handler
function accept a Query<PaginationParams<ScanParams, PageSelector>>
and
return a ResultsPage
. You define your own ScanParams
and
PageSelector
types.
ScanParams
describes the set of querystring parameters that your endpoint
accepts for the first request of the scan (typically: filters and sort
options). This must be deserializable from a querystring.
PageSelector
describes the information your endpoint needs for requests
after the first one. Typically this would include an id of some sort for the
last item on the previous page as well as any parameters related to filtering
or sorting so that your function can apply those, too. The entire
PageSelector
will be serialized to an opaque string and included in the
ResultsPage
. The client is expected to provide this string as the
"page_token"
querystring parameter in the subsequent request.
PageSelector
must implement both Deserialize
and Serialize
.
(Unlike ScanParams
, PageSelector
will not be deserialized directly from
the querystring.)
There are several complete, documented examples in dropshot/examples
.
NOTE: Your choices of ScanParams
and PageSelector
determine the
querystring parameters accepted by your endpoint and the structure of the
page token, respectively. Both of these are part of your API's public
interface, though the page token won't appear in the OpenAPI spec. Be
careful when designing these structures to consider what you might want to
support in the future.
Fields
page: WhichPage<ScanParams, PageSelector>
Specifies whether this is the first request in a scan or a subsequent request, as well as the parameters provided
See WhichPage
for details. Note that this field is flattened by
serde, so you have to look at the variants of WhichPage
to see what
query parameters are actually processed here.
Trait Implementations
impl<ScanParams: Debug, PageSelector: Debug> Debug for PaginationParams<ScanParams, PageSelector> where
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
[src]
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
impl<'de, ScanParams, PageSelector> Deserialize<'de> for PaginationParams<ScanParams, PageSelector> where
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
[src]
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<ScanParams: JsonSchema, PageSelector: JsonSchema> JsonSchema for PaginationParams<ScanParams, PageSelector> where
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
[src]
ScanParams: DeserializeOwned,
PageSelector: DeserializeOwned + Serialize,
fn schema_name() -> String
[src]
fn json_schema(gen: &mut SchemaGenerator) -> Schema
[src]
fn is_referenceable() -> bool
[src]
Auto Trait Implementations
impl<ScanParams, PageSelector> RefUnwindSafe for PaginationParams<ScanParams, PageSelector> where
PageSelector: RefUnwindSafe,
ScanParams: RefUnwindSafe,
PageSelector: RefUnwindSafe,
ScanParams: RefUnwindSafe,
impl<ScanParams, PageSelector> Send for PaginationParams<ScanParams, PageSelector> where
PageSelector: Send,
ScanParams: Send,
PageSelector: Send,
ScanParams: Send,
impl<ScanParams, PageSelector> Sync for PaginationParams<ScanParams, PageSelector> where
PageSelector: Sync,
ScanParams: Sync,
PageSelector: Sync,
ScanParams: Sync,
impl<ScanParams, PageSelector> Unpin for PaginationParams<ScanParams, PageSelector> where
PageSelector: Unpin,
ScanParams: Unpin,
PageSelector: Unpin,
ScanParams: Unpin,
impl<ScanParams, PageSelector> UnwindSafe for PaginationParams<ScanParams, PageSelector> where
PageSelector: UnwindSafe,
ScanParams: UnwindSafe,
PageSelector: UnwindSafe,
ScanParams: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,