pub struct Monitor { /* private fields */ }Expand description
Monitors for device events.
A monitor communicates with the kernel over a socket. Filtering events is performed efficiently in the kernel, and only events that match the filters are received by the socket. Filters must be setup before listening for events.
Implementations§
Source§impl Monitor
impl Monitor
Sourcepub fn match_subsystem<T: AsRef<OsStr>>(&mut self, subsystem: T) -> Result<()>
pub fn match_subsystem<T: AsRef<OsStr>>(&mut self, subsystem: T) -> Result<()>
Adds a filter that matches events for devices with the given subsystem.
Sourcepub fn match_subsystem_devtype<T: AsRef<OsStr>, U: AsRef<OsStr>>(
&mut self,
subsystem: T,
devtype: U,
) -> Result<()>
pub fn match_subsystem_devtype<T: AsRef<OsStr>, U: AsRef<OsStr>>( &mut self, subsystem: T, devtype: U, ) -> Result<()>
Adds a filter that matches events for devices with the given subsystem and device type.
Sourcepub fn match_tag<T: AsRef<OsStr>>(&mut self, tag: T) -> Result<()>
pub fn match_tag<T: AsRef<OsStr>>(&mut self, tag: T) -> Result<()>
Adds a filter that matches events for devices with the given tag.
Sourcepub fn clear_filters(&mut self) -> Result<()>
pub fn clear_filters(&mut self) -> Result<()>
Removes all filters currently set on the monitor.
Sourcepub fn listen(self) -> Result<MonitorSocket>
pub fn listen(self) -> Result<MonitorSocket>
Listens for events matching the current filters.
This method consumes the Monitor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Monitor
impl RefUnwindSafe for Monitor
impl !Send for Monitor
impl !Sync for Monitor
impl Unpin for Monitor
impl UnwindSafe for Monitor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more