Add an enumerate example

This commit is contained in:
Pierre Krieger 2015-09-22 14:43:30 +02:00
parent fee0f0eaf7
commit 8f11173256
1 changed files with 16 additions and 0 deletions

16
examples/enumerate.rs Normal file
View File

@ -0,0 +1,16 @@
extern crate cpal;
use cpal::*;
fn main() {
let endpoints = cpal::get_endpoints_list();
println!("Endpoints: ");
for (endpoint_index, endpoint) in endpoints.enumerate() {
println!("{}. Endpoint \"{}\" Audio formats: ", endpoint_index + 1, endpoint.get_name());
let formats = endpoint.get_supported_formats_list().unwrap();
for (format_index, format) in formats.enumerate() {
println!("{}.{}. {:?}", endpoint_index+1, format_index+1, format);
}
}
}