pub struct Page<T: Clone> {
pub href: String,
pub limit: u32,
pub next: Option<String>,
pub offset: u32,
pub previous: Option<String>,
pub total: u32,
pub items: Vec<Option<T>>,
}Expand description
Fields§
§href: StringThe URL to the API endpoint returning this page.
limit: u32The maximum amount of items in the response.
next: Option<String>The URL to the next page.
For pagination, see get_next.
offset: u32The offset of the returned items.
previous: Option<String>The URL to the previous page.
For pagination, see get_previous.
total: u32The amount of returned items.
items: Vec<Option<T>>A list of the items, which includes null values.
To get only the Some values, use filtered_items.
Implementations§
Source§impl<T: Clone + DeserializeOwned> Page<T>
impl<T: Clone + DeserializeOwned> Page<T>
Sourcepub fn filtered_items(&self) -> Vec<T>
pub fn filtered_items(&self) -> Vec<T>
Get a list of only the Some values from a Page’s items.
Sourcepub async fn get_next(
&self,
spotify: &Client<Token, impl AuthFlow>,
) -> Result<Self>
pub async fn get_next( &self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Self>
Get the next page.
If there is no next page, this will return an
Error::NoRemainingPages.
Sourcepub async fn get_previous(
&self,
spotify: &Client<Token, impl AuthFlow>,
) -> Result<Self>
pub async fn get_previous( &self, spotify: &Client<Token, impl AuthFlow>, ) -> Result<Self>
Get the previous page.
If there is no previous page, this will return an
Error::NoRemainingPages.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Page<T>where
T: Deserialize<'de> + Clone,
impl<'de, T> Deserialize<'de> for Page<T>where
T: Deserialize<'de> + Clone,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Clone> StructuralPartialEq for Page<T>
Auto Trait Implementations§
impl<T> Freeze for Page<T>
impl<T> RefUnwindSafe for Page<T>where
T: RefUnwindSafe,
impl<T> Send for Page<T>where
T: Send,
impl<T> Sync for Page<T>where
T: Sync,
impl<T> Unpin for Page<T>where
T: Unpin,
impl<T> UnsafeUnpin for Page<T>
impl<T> UnwindSafe for Page<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more