1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use DeviceInfo;
use ffi;
use std::{ops, slice};
ffi_type_stack! {
type CType = ffi::cubeb_device_collection;
#[derive(Debug)]
pub struct DeviceCollection;
pub struct DeviceCollectionRef;
}
impl ops::Deref for DeviceCollectionRef {
type Target = [DeviceInfo];
fn deref(&self) -> &[DeviceInfo] {
unsafe {
let coll: &ffi::cubeb_device_collection = &*self.as_ptr();
slice::from_raw_parts(coll.device as *const DeviceInfo, coll.count)
}
}
}