diff --git a/src/client/param/pagination.rs b/src/client/param/pagination.rs index 3b4918c..c143961 100644 --- a/src/client/param/pagination.rs +++ b/src/client/param/pagination.rs @@ -1,5 +1,36 @@ //! Features for pagination. +use serde::Deserialize; + +/// A prisecter. +/// +/// A **prisecter** is consisting of three floats. +/// It allows you to continue paginating. +#[derive(Clone, Debug, Deserialize)] +pub struct Prisecter { + /// The primary sort key. + pub pri: f64, + /// The secondary sort key. + pub sec: f64, + /// The tertiary sort key. + pub ter: f64, +} + +impl Prisecter { + /// Converts to an array. + /// + /// This array can be used as a bound for the next search. + pub fn to_array(&self) -> [f64; 3] { + [self.pri, self.sec, self.ter] + } +} + +impl AsRef for Prisecter { + fn as_ref(&self) -> &Self { + self + } +} + /// A bound to paginate. #[derive(Clone, Debug)] pub enum Bound { diff --git a/src/model/leaderboard.rs b/src/model/leaderboard.rs index 5d822b5..5154fc6 100644 --- a/src/model/leaderboard.rs +++ b/src/model/leaderboard.rs @@ -1,6 +1,7 @@ //! The User Leaderboard models. use crate::{ + client::param::pagination::Prisecter, model::{ cache::CacheData, league_rank::Rank, @@ -214,35 +215,6 @@ impl AsRef for League { } } -/// A prisecter. -/// -/// A **prisecter** is consisting of three floats. -/// It allows you to continue paginating. -#[derive(Clone, Debug, Deserialize)] -pub struct Prisecter { - /// The primary sort key. - pub pri: f64, - /// The secondary sort key. - pub sec: f64, - /// The tertiary sort key. - pub ter: f64, -} - -impl Prisecter { - /// Converts this prisecter to an array. - /// - /// This array can be used as a bound for the next search. - pub fn to_array(&self) -> [f64; 3] { - [self.pri, self.sec, self.ter] - } -} - -impl AsRef for Prisecter { - fn as_ref(&self) -> &Self { - self - } -} - /// The response for the Historical User Leaderboard data. /// /// An array of historical user blobs fulfilling the search criteria. diff --git a/src/model/summary/record.rs b/src/model/summary/record.rs index e26034f..da055c9 100644 --- a/src/model/summary/record.rs +++ b/src/model/summary/record.rs @@ -1,7 +1,8 @@ //! The Record Data models. use crate::{ - model::{leaderboard::Prisecter, league_rank::Rank, user::UserId}, + client::param::pagination::Prisecter, + model::{league_rank::Rank, user::UserId}, util::to_unix_ts, }; use serde::Deserialize;