Skip to content

Commit

Permalink
TrackQueue: Add current_queue method (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
peppizza committed Nov 19, 2020
1 parent 2da5901 commit 69acea8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/tracks/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ impl TrackQueue {

inner.stop_current()
}

/// Returns a list of currently queued tracks.
///
/// Does not allow for modification of the queue, instead returns a snapshot of the queue at the time of calling.
///
/// Use [`modify_queue`] for direct modification of the queue.
///
/// [`modify_queue`]: #method.modify_queue
pub fn current_queue(&self) -> Vec<TrackHandle> {
let inner = self.inner.lock();

inner.tracks.iter().map(|q| q.handle()).collect()
}
}

impl TrackQueueCore {
Expand Down

0 comments on commit 69acea8

Please sign in to comment.