mirror of
https://github.com/Dangoware/dmp-core.git
synced 2025-04-19 13:22:54 -05:00
Added benchmark for testing
This commit is contained in:
parent
eeceb27800
commit
421ab0c757
2 changed files with 5 additions and 4 deletions
|
@ -85,6 +85,6 @@ impl MusicController {
|
|||
sort_by: Vec<Tag>,
|
||||
) -> Option<Vec<&Song>> {
|
||||
self.library
|
||||
.query(query_string, &target_tags, &sort_by)
|
||||
.query_tracks(query_string, &target_tags, &sort_by)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -664,7 +664,7 @@ impl MusicLibrary {
|
|||
///
|
||||
/// Example:
|
||||
/// ```
|
||||
/// query(
|
||||
/// query_tracks(
|
||||
/// &String::from("query"),
|
||||
/// &vec![
|
||||
/// Tag::Title
|
||||
|
@ -680,7 +680,7 @@ impl MusicLibrary {
|
|||
/// This would find all titles containing the sequence
|
||||
/// "query", and would return the results sorted first
|
||||
/// by path, then album, disk number, and finally track number.
|
||||
pub fn query(
|
||||
pub fn query_tracks(
|
||||
&self,
|
||||
query_string: &String, // The query itself
|
||||
target_tags: &Vec<Tag>, // The tags to search
|
||||
|
@ -773,7 +773,7 @@ impl MusicLibrary {
|
|||
None => continue
|
||||
};
|
||||
|
||||
match albums.binary_search_by_key(&normalize(&title), |album| normalize(&album.title.to_owned())) {
|
||||
match albums.binary_search_by_key(&title, |album| album.title) {
|
||||
Ok(pos) => {
|
||||
albums[pos].tracks.push(result);
|
||||
},
|
||||
|
@ -791,4 +791,5 @@ impl MusicLibrary {
|
|||
|
||||
Ok(albums)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue