File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -234,12 +234,26 @@ where
234234
235235 /// Client-requested limit on page size (optional)
236236 ///
237- /// Consumers should use
238- /// [`RequestContext`][crate::handler::RequestContext::page_limit()]
239- /// to access this value.
237+ /// While this is publicly settable via the `Deserialize` implementation, it
238+ /// is untrusted and therefore hidden from users. Consumers should instead
239+ /// use [`RequestContext`][crate::handler::RequestContext::page_limit()],
240+ /// which has gone through validation against the server config, to access
241+ /// this value.
240242 pub ( crate ) limit : Option < NonZeroU32 > ,
241243}
242244
245+ impl < ScanParams , PageSelector > PaginationParams < ScanParams , PageSelector >
246+ where
247+ ScanParams : DeserializeOwned ,
248+ PageSelector : DeserializeOwned + Serialize ,
249+ {
250+ /// Construct a new [`PaginationParams`] representing the first page of a
251+ /// scan.
252+ pub fn new_first_page ( p : ScanParams , limit : Option < NonZeroU32 > ) -> Self {
253+ Self { page : WhichPage :: First ( p) , limit }
254+ }
255+ }
256+
243257pub ( crate ) const PAGINATION_PARAM_SENTINEL : & str =
244258 "x-dropshot-pagination-param" ;
245259pub ( crate ) const PAGINATION_EXTENSION : & str = "x-dropshot-pagination" ;
You can’t perform that action at this time.
0 commit comments