Skip to main content

Paginated

Trait Paginated 

Source
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§

Source

type Item

The item type yielded per page (the envelope’s data element type).

Required Methods§

Source

fn page(&self) -> i64

The 1-based page number this response represents.

Source

fn limit(&self) -> i64

The page size requested/echoed back by the server.

Source

fn total(&self) -> Option<i64>

The total number of items across all pages, if the envelope reports one.

Source

fn into_items(self) -> Vec<Self::Item>

Consumes the response, yielding this page’s items.

Implementors§