MCPcopy Create free account
hub / github.com/Moosync/Moosync / shuffle_queue

Method shuffle_queue

src/store/player_store.rs:505–520  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

503
504 #[tracing::instrument(level = "debug", skip(self))]
505 pub fn shuffle_queue(&mut self) {
506 let binding = self.data.queue.song_queue.clone();
507 let current_song = binding.get(self.data.queue.current_index).unwrap();
508 let mut rng = rand::thread_rng();
509 self.data.queue.song_queue.shuffle(&mut rng);
510 let new_index = self
511 .data
512 .queue
513 .song_queue
514 .iter()
515 .position(|v| v == current_song)
516 .unwrap();
517 self.data.queue.current_index = new_index;
518
519 self.dump_store(&[DumpType::CurrentIndex, DumpType::SongQueue]);
520 }
521
522 #[tracing::instrument(level = "debug", skip(self))]
523 pub fn clear_queue(&mut self) {

Callers 1

ControlsFunction · 0.80

Calls 3

cloneMethod · 0.80
getMethod · 0.80
dump_storeMethod · 0.80

Tested by

no test coverage detected