TrackQueue: Add current_queue method (#16)

This commit is contained in:
baguette
2020-11-18 19:33:00 -05:00
committed by GitHub
parent 2da5901930
commit 69acea8664

View File

@@ -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 {