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§fn udev(&self) -> &Udev
fn udev(&self) -> &Udev
The
udev context with which this struct was created. This must live at least as long as
the struct itself or undefined behavior will result.Source§fn into_raw_with_context(self) -> (*mut udev, *mut udev_monitor)
fn into_raw_with_context(self) -> (*mut udev, *mut udev_monitor)
Convert the object into the raw
udev pointer and the underlying pointer for this object. Read moreSource§impl FromRawWithContext<udev_monitor> for Builder
impl FromRawWithContext<udev_monitor> for Builder
Source§unsafe fn from_raw_with_context(udev: *mut udev, t: *mut udev_monitor) -> Self
unsafe fn from_raw_with_context(udev: *mut udev, t: *mut udev_monitor) -> Self
Create an object from a given raw pointer and
udev context pointer. Read moreAuto 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§
Source§impl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
T: AsFd,
Source§fn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
Borrows the reference. Read more
Source§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 moreSource§impl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
Source§fn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
Source§impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
Source§fn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
Source§impl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
Source§fn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
Source§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