#![allow(dead_code)] use BuildStreamError; use DefaultFormatError; use Device as DeviceTrait; use DevicesError; use DeviceNameError; use EventLoop as EventLoopTrait; use Format; use Host as HostTrait; use PauseStreamError; use PlayStreamError; use StreamDataResult; use SupportedFormatsError; use StreamId as StreamIdTrait; use SupportedFormat; #[derive(Default)] pub struct Devices; #[derive(Clone, Debug, PartialEq, Eq)] pub struct Device; pub struct EventLoop; pub struct Host; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct StreamId; pub struct SupportedInputFormats; pub struct SupportedOutputFormats; impl Host { pub fn new() -> Result { Ok(Host) } } impl Devices { pub fn new() -> Result { Ok(Devices) } } impl EventLoop { pub fn new() -> EventLoop { EventLoop } } impl DeviceTrait for Device { type SupportedInputFormats = SupportedInputFormats; type SupportedOutputFormats = SupportedOutputFormats; #[inline] fn name(&self) -> Result { Ok("null".to_owned()) } #[inline] fn supported_input_formats(&self) -> Result { unimplemented!() } #[inline] fn supported_output_formats(&self) -> Result { unimplemented!() } #[inline] fn default_input_format(&self) -> Result { unimplemented!() } #[inline] fn default_output_format(&self) -> Result { unimplemented!() } } impl EventLoopTrait for EventLoop { type Device = Device; type StreamId = StreamId; #[inline] fn run(&self, _callback: F) -> ! where F: FnMut(StreamId, StreamDataResult) { loop { /* TODO: don't spin */ } } #[inline] fn build_input_stream(&self, _: &Device, _: &Format) -> Result { Err(BuildStreamError::DeviceNotAvailable) } #[inline] fn build_output_stream(&self, _: &Device, _: &Format) -> Result { Err(BuildStreamError::DeviceNotAvailable) } #[inline] fn destroy_stream(&self, _: StreamId) { unimplemented!() } #[inline] fn play_stream(&self, _: StreamId) -> Result<(), PlayStreamError> { panic!() } #[inline] fn pause_stream(&self, _: StreamId) -> Result<(), PauseStreamError> { panic!() } } impl HostTrait for Host { type Device = Device; type Devices = Devices; type EventLoop = EventLoop; fn is_available() -> bool { false } fn devices(&self) -> Result { Devices::new() } fn default_input_device(&self) -> Option { None } fn default_output_device(&self) -> Option { None } fn event_loop(&self) -> Self::EventLoop { EventLoop::new() } } impl StreamIdTrait for StreamId {} impl Iterator for Devices { type Item = Device; #[inline] fn next(&mut self) -> Option { None } } impl Iterator for SupportedInputFormats { type Item = SupportedFormat; #[inline] fn next(&mut self) -> Option { None } } impl Iterator for SupportedOutputFormats { type Item = SupportedFormat; #[inline] fn next(&mut self) -> Option { None } }