pub struct AnalysisHandler;Implementations§
Source§impl AnalysisHandler
impl AnalysisHandler
Sourcepub fn analyze_file<T: DeserializeOwned + TrackAnalyzable>(
file_path: &Path,
threshold: usize,
) -> Result<TrackStats, Box<dyn Error>>
pub fn analyze_file<T: DeserializeOwned + TrackAnalyzable>( file_path: &Path, threshold: usize, ) -> Result<TrackStats, Box<dyn Error>>
Analyze tracks from a JSON file
§Arguments
file_path- Path to the JSON file containing track datathreshold- Minimum play count threshold. Tracks with fewer plays than this value will be counted separately. For example, use 5 to identify tracks played less than 5 times.
§Errors
std::io::Error- If there was an error reading the fileserde_json::Error- If the JSON cannot be parsed
§Returns
Result<TrackStats, Box<dyn std::error::Error>>- Analysis results
Sourcepub fn analyze_tracks<T: TrackAnalyzable>(
tracks: &[T],
threshold: usize,
) -> TrackStats
pub fn analyze_tracks<T: TrackAnalyzable>( tracks: &[T], threshold: usize, ) -> TrackStats
Analyze a vector of tracks
§Arguments
tracks- Vector of tracks to analyze (must implementTrackAnalyzable)threshold- Minimum play count threshold. Tracks with fewer plays than this value will be counted separately. For example, use 5 to identify tracks played less than 5 times.
§Returns
TrackStats- Analysis results containing play counts, most played tracks, and threshold-based groupings
Sourcepub fn print_analysis(stats: &TrackStats)
pub fn print_analysis(stats: &TrackStats)
Sourcepub fn get_most_recent_timestamp<T: DeserializeOwned + Timestamped>(
file_path: &Path,
) -> Result<Option<i64>>
pub fn get_most_recent_timestamp<T: DeserializeOwned + Timestamped>( file_path: &Path, ) -> Result<Option<i64>>
Get the most recent timestamp from a JSON file.
§Arguments
file_path- Path to the JSON file
§Errors
std::io::Error- If the file cannot be opened or readLastFmError::Io- If the file cannot be openedLastFmError::Parse- If the JSON cannot be deserialized
§Returns
Option<i64>- Most recent timestamp
Auto Trait Implementations§
impl Freeze for AnalysisHandler
impl RefUnwindSafe for AnalysisHandler
impl Send for AnalysisHandler
impl Sync for AnalysisHandler
impl Unpin for AnalysisHandler
impl UnwindSafe for AnalysisHandler
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