pub struct Enumerator { /* private fields */ }Expand description
An enumeration context.
An Enumerator scans /sys for devices matching its filters. Filters are added to an Enumerator
by calling its match_* and nomatch_* methods. After the filters are setup, the
scan_devices() method finds devices in /sys that match the filters.
Implementations§
Source§impl Enumerator
impl Enumerator
Sourcepub fn new() -> Result<Enumerator, Error>
pub fn new() -> Result<Enumerator, Error>
Creates a new Enumerator.
Sourcepub fn with_udev(udev: Udev) -> Result<Enumerator, Error>
pub fn with_udev(udev: Udev) -> Result<Enumerator, Error>
Creates a new Enumerator with an existing Udev instance
Sourcepub fn match_is_initialized(&mut self) -> Result<(), Error>
pub fn match_is_initialized(&mut self) -> Result<(), Error>
Adds a filter that matches only initialized devices.
Sourcepub fn match_subsystem<T>(&mut self, subsystem: T) -> Result<(), Error>
pub fn match_subsystem<T>(&mut self, subsystem: T) -> Result<(), Error>
Adds a filter that matches only devices that belong to the given kernel subsystem.
Sourcepub fn match_attribute<T, U>(
&mut self,
attribute: T,
value: U,
) -> Result<(), Error>
pub fn match_attribute<T, U>( &mut self, attribute: T, value: U, ) -> Result<(), Error>
Adds a filter that matches only devices with the given attribute value.
Sourcepub fn match_sysname<T>(&mut self, sysname: T) -> Result<(), Error>
pub fn match_sysname<T>(&mut self, sysname: T) -> Result<(), Error>
Adds a filter that matches only devices with the given kernel device name.
Sourcepub fn match_property<T, U>(
&mut self,
property: T,
value: U,
) -> Result<(), Error>
pub fn match_property<T, U>( &mut self, property: T, value: U, ) -> Result<(), Error>
Adds a filter that matches only devices with the given property value.
Sourcepub fn match_tag<T>(&mut self, tag: T) -> Result<(), Error>
pub fn match_tag<T>(&mut self, tag: T) -> Result<(), Error>
Adds a filter that matches only devices with the given tag.
Sourcepub fn match_parent(&mut self, parent: &Device) -> Result<(), Error>
pub fn match_parent(&mut self, parent: &Device) -> Result<(), Error>
Includes the parent device and all devices in the subtree of the parent device.
Sourcepub fn nomatch_subsystem<T>(&mut self, subsystem: T) -> Result<(), Error>
pub fn nomatch_subsystem<T>(&mut self, subsystem: T) -> Result<(), Error>
Adds a filter that matches only devices that don’t belong to the given kernel subsystem.
Sourcepub fn nomatch_attribute<T, U>(
&mut self,
attribute: T,
value: U,
) -> Result<(), Error>
pub fn nomatch_attribute<T, U>( &mut self, attribute: T, value: U, ) -> Result<(), Error>
Adds a filter that matches only devices that don’t have the the given attribute value.
Sourcepub fn add_syspath<T>(&mut self, syspath: T) -> Result<(), Error>
pub fn add_syspath<T>(&mut self, syspath: T) -> Result<(), Error>
Includes the device with the given syspath.
Sourcepub fn scan_devices(&mut self) -> Result<Devices, Error>
pub fn scan_devices(&mut self) -> Result<Devices, Error>
Scans /sys for devices matching the attached filters.
The devices will be sorted in dependency order.
Trait Implementations§
Source§impl AsRawWithContext<udev_enumerate> for Enumerator
impl AsRawWithContext<udev_enumerate> for Enumerator
Source§fn udev(&self) -> &Udev
fn udev(&self) -> &Udev
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_enumerate)
fn into_raw_with_context(self) -> (*mut udev, *mut udev_enumerate)
udev pointer and the underlying pointer for this object. Read moreSource§impl Clone for Enumerator
impl Clone for Enumerator
Source§fn clone(&self) -> Enumerator
fn clone(&self) -> Enumerator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Drop for Enumerator
impl Drop for Enumerator
Source§impl FromRawWithContext<udev_enumerate> for Enumerator
impl FromRawWithContext<udev_enumerate> for Enumerator
Source§unsafe fn from_raw_with_context(
udev: *mut udev,
t: *mut udev_enumerate,
) -> Enumerator
unsafe fn from_raw_with_context( udev: *mut udev, t: *mut udev_enumerate, ) -> Enumerator
udev context pointer. Read more