cpal/src/coreaudio/enumerate.rs

37 lines
686 B
Rust
Raw Normal View History

use super::Endpoint;
2017-10-20 19:18:40 +00:00
use SupportedFormat;
use std::vec::IntoIter as VecIntoIter;
pub struct EndpointsIterator(bool);
2017-10-11 11:24:49 +00:00
unsafe impl Send for EndpointsIterator {
}
unsafe impl Sync for EndpointsIterator {
}
impl Default for EndpointsIterator {
fn default() -> Self {
EndpointsIterator(false)
}
}
impl Iterator for EndpointsIterator {
type Item = Endpoint;
fn next(&mut self) -> Option<Endpoint> {
2017-10-11 11:24:49 +00:00
if self.0 {
None
} else {
self.0 = true;
Some(Endpoint)
}
}
}
pub fn default_endpoint() -> Option<Endpoint> {
Some(Endpoint)
}
2017-10-20 19:18:40 +00:00
pub type SupportedFormatsIterator = VecIntoIter<SupportedFormat>;