pub struct TopTracksRequestBuilder { /* private fields */ }Expand description
Builder for top tracks requests
Implementations§
Source§impl TopTracksRequestBuilder
impl TopTracksRequestBuilder
Sourcepub fn on_progress(
self,
callback: impl Fn(u32, u32) + Send + Sync + 'static,
) -> Self
pub fn on_progress( self, callback: impl Fn(u32, u32) + Send + Sync + 'static, ) -> Self
Register a progress callback invoked with (fetched, total) after each batch.
Sourcepub const fn period(self, period: Period) -> Self
pub const fn period(self, period: Period) -> Self
Set the time period for top tracks
§Arguments
period- The time range to calculate top tracks over. UsePeriod::Overallfor all-time,Period::Weekfor last 7 days,Period::Monthfor last 30 days, etc. If not set, defaults to the Last.fm API’s default behavior (typically overall).
§Example
ⓘ
use lastfm_client::api::Period;
let tracks = client.top_tracks("username")
.period(Period::Month)
.limit(50)
.fetch()
.await?;Trait Implementations§
Source§impl Debug for TopTracksRequestBuilder
impl Debug for TopTracksRequestBuilder
Source§impl FetchAndSave for TopTracksRequestBuilder
impl FetchAndSave for TopTracksRequestBuilder
Source§fn resource_label() -> &'static str
fn resource_label() -> &'static str
A human-readable label used in log messages (e.g.
"top tracks").Source§fn latest_timestamp(_items: &[Self::Item]) -> Option<u32>
fn latest_timestamp(_items: &[Self::Item]) -> Option<u32>
Return the most recent timestamp from the given items, used to write a sidecar file
after saving. Return
None (the default) if the item type has no timestamp.Source§async fn fetch_and_save(
self,
format: FileFormat,
filename_prefix: &str,
) -> Result<String>
async fn fetch_and_save( self, format: FileFormat, filename_prefix: &str, ) -> Result<String>
Fetch items and save them to a file. Read more
Auto Trait Implementations§
impl Freeze for TopTracksRequestBuilder
impl !RefUnwindSafe for TopTracksRequestBuilder
impl Send for TopTracksRequestBuilder
impl Sync for TopTracksRequestBuilder
impl Unpin for TopTracksRequestBuilder
impl UnsafeUnpin for TopTracksRequestBuilder
impl !UnwindSafe for TopTracksRequestBuilder
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