pub trait DeviceManager {
type DeviceType: Device;
// Required methods
fn init() -> Result<Self>
where Self: Sized;
fn deinit(&mut self);
fn list(&self) -> Vec<&Self::DeviceType>;
fn index(&self, index: usize) -> Option<&Self::DeviceType>;
fn index_mut(&mut self, index: usize) -> Option<&mut Self::DeviceType>;
fn lookup(&self, id: &str) -> Option<&Self::DeviceType>;
fn lookup_mut(&mut self, id: &str) -> Option<&mut Self::DeviceType>;
fn refresh(&mut self) -> Result<()>;
fn set_change_handler<F>(&mut self, handler: F) -> Result<()>
where F: Fn(&DeviceEvent) + Send + Sync + 'static;
}Required Associated Types§
type DeviceType: Device
Required Methods§
fn init() -> Result<Self>where
Self: Sized,
fn deinit(&mut self)
fn list(&self) -> Vec<&Self::DeviceType>
fn index(&self, index: usize) -> Option<&Self::DeviceType>
fn index_mut(&mut self, index: usize) -> Option<&mut Self::DeviceType>
fn lookup(&self, id: &str) -> Option<&Self::DeviceType>
fn lookup_mut(&mut self, id: &str) -> Option<&mut Self::DeviceType>
fn refresh(&mut self) -> Result<()>
fn set_change_handler<F>(&mut self, handler: F) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.