pub struct ArtistsIterator<C: LastFmEditClient> { /* private fields */ }Expand description
Iterator for browsing all artists in the user’s library.
This iterator provides access to all artists in the authenticated user’s Last.fm library, sorted by play count (highest first). The iterator loads artists as needed and handles rate limiting automatically to be respectful to Last.fm’s servers.
§Examples
let mut client = LastFmEditClientImpl::from_session(Box::new(http_client::native::NativeClient::new()), test_session);
let mut artists = client.artists();
// Get the top 10 artists
let top_artists = artists.take(10).await?;
for artist in top_artists {
println!("{} ({} plays)", artist.name, artist.playcount);
}Implementations§
Source§impl<C: LastFmEditClient> ArtistsIterator<C>
impl<C: LastFmEditClient> ArtistsIterator<C>
Sourcepub fn new(client: C) -> Self
pub fn new(client: C) -> Self
Create a new artists iterator.
This iterator will start from page 1 and load all artists in the user’s library.
Sourcepub fn with_starting_page(client: C, starting_page: u32) -> Self
pub fn with_starting_page(client: C, starting_page: u32) -> Self
Create a new artists iterator starting from a specific page.
This is useful for implementing offset functionality efficiently by starting at the appropriate page rather than iterating through all previous pages.
Sourcepub async fn next_page(&mut self) -> Result<Option<ArtistPage>>
pub async fn next_page(&mut self) -> Result<Option<ArtistPage>>
Fetch the next page of artists.
This method handles pagination automatically and includes rate limiting to be respectful to Last.fm’s servers.
Sourcepub fn total_pages(&self) -> Option<u32>
pub fn total_pages(&self) -> Option<u32>
Get the total number of pages, if known.
Returns None until at least one page has been fetched.