Function bliss_audio::playlist::song_to_song_by_key
source · pub fn song_to_song_by_key<F, T: PartialEq + Clone>(
first_song: &T,
songs: &mut Vec<T>,
distance: impl DistanceMetric,
key_fn: F
)
Expand description
Sort songs
in place using the distance
metric and ordering by
the smallest distance between each song.
If the generated playlist is [song1, song2, song3, song4]
, it means
song2 is closest to song1, song3 is closest to song2, and song4 is closest
to song3.
Note that this has a tendency to go from one style to the other very fast, and it can be slow on big libraries.
Sort songs with a key extraction function, useful for when you have a
structure like CustomSong { bliss_song: Song, something_else: bool }