#[non_exhaustive]pub struct AnalysisHandler;Expand description
Handler for track analysis operations
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)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnalysisHandler
impl RefUnwindSafe for AnalysisHandler
impl Send for AnalysisHandler
impl Sync for AnalysisHandler
impl Unpin for AnalysisHandler
impl UnsafeUnpin 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