# Pegination Implementation of cursor pagination. See the tests for details. ### Requirements #### 1. Structure `SourceRequest` Source request sent to API ```rust #[derive(Debug, Clone)] struct SourceRequest {} ``` #### 2. Structure `Filters` Data source filters, excludes limit and offset ```rust #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] struct Filters {} ``` #### 3. Structure `Item` Data source entity ```rust #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] struct Item {} ``` #### 4. Entity `Error` ```rust enum AppError {} ``` ### Required implementations #### 1. `SourceRequest` to `Request` transormation ```rust impl TryFrom for Request {} ``` #### 2. `DataSource` ```rust trait DataSource ``` ### Usage Having all of the stuff described above, you can use `pagination` function this way: ```rust const DEFAULT_LIMIT: u16 = 100; let paginated_data = pagination::(data_source, source_request, DEFAULT_LIMIT).await?; // { // "last_cursor": null, // "has_next_page": false, // "data": [ // ..items // ] // } ```