pub struct ArtistTracksIterator<'a> { /* private fields */ }Expand description
Iterator for browsing an artist’s tracks from a user’s library.
This iterator provides paginated access to all tracks by a specific artist in the authenticated user’s Last.fm library, ordered by play count.
§Examples
let mut client = LastFmClient::new(Box::new(http_client::native::NativeClient::new()));
// client.login(...).await?;
let mut tracks = client.artist_tracks("The Beatles");
// Get the top 5 most played tracks
let top_tracks = tracks.take(5).await?;
for track in top_tracks {
println!("{} (played {} times)", track.name, track.playcount);
}Implementations§
Source§impl<'a> ArtistTracksIterator<'a>
impl<'a> ArtistTracksIterator<'a>
Sourcepub fn new(client: &'a mut LastFmClient, artist: String) -> Self
pub fn new(client: &'a mut LastFmClient, artist: String) -> Self
Create a new artist tracks iterator.
This is typically called via LastFmClient::artist_tracks.
Sourcepub async fn next_page(&mut self) -> Result<Option<TrackPage>>
pub async fn next_page(&mut self) -> Result<Option<TrackPage>>
Fetch the next page of tracks.
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.
Trait Implementations§
Source§impl<'a> AsyncPaginatedIterator for ArtistTracksIterator<'a>
impl<'a> AsyncPaginatedIterator for ArtistTracksIterator<'a>
Source§async fn next(&mut self) -> Result<Option<Self::Item>>
async fn next(&mut self) -> Result<Option<Self::Item>>
Fetch the next item from the iterator. Read more
Source§fn current_page(&self) -> u32
fn current_page(&self) -> u32
Get the current page number (0-indexed). Read more
Auto Trait Implementations§
impl<'a> Freeze for ArtistTracksIterator<'a>
impl<'a> !RefUnwindSafe for ArtistTracksIterator<'a>
impl<'a> Send for ArtistTracksIterator<'a>
impl<'a> Sync for ArtistTracksIterator<'a>
impl<'a> Unpin for ArtistTracksIterator<'a>
impl<'a> !UnwindSafe for ArtistTracksIterator<'a>
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