DeviceManager

Trait DeviceManager 

Source
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§

Required Methods§

Source

fn init() -> Result<Self>
where Self: Sized,

Source

fn deinit(&mut self)

Source

fn list(&self) -> Vec<&Self::DeviceType>

Source

fn index(&self, index: usize) -> Option<&Self::DeviceType>

Source

fn index_mut(&mut self, index: usize) -> Option<&mut Self::DeviceType>

Source

fn lookup(&self, id: &str) -> Option<&Self::DeviceType>

Source

fn lookup_mut(&mut self, id: &str) -> Option<&mut Self::DeviceType>

Source

fn refresh(&mut self) -> Result<()>

Source

fn set_change_handler<F>(&mut self, handler: F) -> Result<()>
where F: Fn(&DeviceEvent) + Send + Sync + 'static,

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.

Implementors§