pub trait Paginated {
type Item;
// Required methods
fn page(&self) -> i64;
fn limit(&self) -> i64;
fn total(&self) -> Option<i64>;
fn into_items(self) -> Vec<Self::Item>;
}Expand description
Implemented by paged response envelopes — the page/limit/data shape
shared by several Datamaxi+ endpoints, with or without a total (e.g.
CexAnnouncementsResponse reports total; FundingRateHistoryResponse
does not) — so Client::paginate / [sync::Client::paginate] can
drive a generic auto-paginator over them without codegen needing to emit a
bespoke helper per endpoint.
Envelopes without a total (see Paginated::total) auto-paginate the
same way, just terminating only on an empty page rather than also on
page * limit >= total.
Required Associated Types§
Required Methods§
Sourcefn total(&self) -> Option<i64>
fn total(&self) -> Option<i64>
The total number of items across all pages, if the envelope reports one.
Sourcefn into_items(self) -> Vec<Self::Item>
fn into_items(self) -> Vec<Self::Item>
Consumes the response, yielding this page’s items.