Add a len() method to Sink for some insight into the queue state.

This commit is contained in:
Will Stott 2019-03-01 12:14:30 +00:00
parent 25d3151917
commit f36411f6f5

View file

@ -148,7 +148,13 @@ impl Sink {
/// Returns true if this sink has no more sounds to play.
#[inline]
pub fn empty(&self) -> bool {
self.sound_count.load(Ordering::Relaxed) == 0
self.len() == 0
}
/// Returns the number of sounds currently in the queue.
#[inline]
pub fn len(&self) -> usize {
self.sound_count.load(Ordering::Relaxed)
}
}