sound_stream 0.6.0

Provides a simple interface to the default audio input and output device streams on a user's system.
1
2
3
4
5
6
7
8
9
10

use std::collections::VecDeque;

/// Take the given number of elements from the front of the VecDeque.
///
/// Fails if the num_elems given is higher than the length of the VecDeque.
pub fn take_front<T>(vec: &mut VecDeque<T>, num_elems: usize) -> Vec<T> {
    (0..num_elems).map(|_| vec.pop_front().unwrap()).collect()
}