Struct MonitorBuilder

Source
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

Source

pub fn new() -> Result<Self>

Creates a new udev event Monitor.

Source

pub fn new_kernel() -> Result<Self>

Creates a new kernel event Monitor.

Source

pub fn match_subsystem<T: AsRef<OsStr>>(self, subsystem: T) -> Result<Self>

Adds a filter that matches events for devices with the given subsystem.

Source

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.

Source

pub fn match_tag<T: AsRef<OsStr>>(self, tag: T) -> Result<Self>

Adds a filter that matches events for devices with the given tag.

Source

pub fn clear_filters(self) -> Result<Self>

Removes all filters currently set on the monitor.

Source

pub fn listen(self) -> Result<Socket>

Listens for events matching the current filters.

This method consumes the Monitor.

Trait Implementations§

Source§

impl AsFd for Builder

Provides raw access to the monitor’s socket.

Source§

fn as_fd(&self) -> BorrowedFd<'_>

Returns the file descriptor of the monitor’s socket.

Source§

impl AsRawFd for Builder

Provides raw access to the monitor’s socket.

Source§

fn as_raw_fd(&self) -> RawFd

Returns the file descriptor of the monitor’s socket.

Source§

impl AsRawWithContext<udev_monitor> for Builder

Source§

fn as_raw(&self) -> *mut udev_monitor

Get a reference of the underlying struct. Read more
Source§

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)

Convert the object into the raw udev pointer and the underlying pointer for this object. Read more
Source§

impl Clone for Builder

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for Builder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FromRawWithContext<udev_monitor> for Builder

Source§

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 more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsFilelike for T
where T: AsFd,

§

fn as_filelike(&self) -> BorrowedFd<'_>

Borrows the reference. Read more
§

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 T
where T: AsRawFd,

§

fn as_raw_filelike(&self) -> i32

Returns the raw value.
§

impl<T> AsRawSocketlike for T
where T: AsRawFd,

§

fn as_raw_socketlike(&self) -> i32

Returns the raw value.
§

impl<T> AsSocketlike for T
where T: AsFd,

§

fn as_socketlike(&self) -> BorrowedFd<'_>

Borrows the reference.
§

fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>
where Target: SocketlikeViewType,

Return a borrowing view of a resource which dereferences to a &Target. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.