pub struct MonitorBuilder { /* 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 set up before listening for events.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new_kernel() -> Result<Self>
pub fn new_kernel() -> Result<Self>
Creates a new kernel event Monitor
.
Sourcepub fn match_subsystem<T: AsRef<OsStr>>(self, subsystem: T) -> Result<Self>
pub fn match_subsystem<T: AsRef<OsStr>>(self, subsystem: T) -> Result<Self>
Adds a filter that matches events for devices with the given subsystem.
Sourcepub fn match_subsystem_devtype<T: AsRef<OsStr>, U: AsRef<OsStr>>(
self,
subsystem: T,
devtype: U,
) -> Result<Self>
pub fn match_subsystem_devtype<T: AsRef<OsStr>, U: AsRef<OsStr>>( self, subsystem: T, devtype: U, ) -> Result<Self>
Adds a filter that matches events for devices with the given subsystem and device type.
Sourcepub fn match_tag<T: AsRef<OsStr>>(self, tag: T) -> Result<Self>
pub fn match_tag<T: AsRef<OsStr>>(self, tag: T) -> Result<Self>
Adds a filter that matches events for devices with the given tag.
Sourcepub fn clear_filters(self) -> Result<Self>
pub fn clear_filters(self) -> Result<Self>
Removes all filters currently set on the monitor.
Trait Implementations§
Source§impl AsFd for Builder
Provides raw access to the monitor’s socket.
impl AsFd for Builder
Provides raw access to the monitor’s socket.
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Returns the file descriptor of the monitor’s socket.
Source§impl AsRawWithContext<udev_monitor> for Builder
impl AsRawWithContext<udev_monitor> for Builder
Source§impl FromRawWithContext<udev_monitor> for Builder
impl FromRawWithContext<udev_monitor> for Builder
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
§impl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
T: AsFd,
§fn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
Borrows the reference. Read more
§fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read more§impl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
§fn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
§impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
§fn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
§impl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
§fn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read moreSource§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