Struct libudev::Enumerator
[−]
[src]
pub struct Enumerator<'a> { /* fields omitted */ }
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.
Methods
impl<'a> Enumerator<'a>
[src]
fn new(context: &'a Context) -> Result<Self>
Creates a new Enumerator.
fn match_is_initialized(&mut self) -> Result<()>
Adds a filter that matches only initialized devices.
fn match_subsystem<T: AsRef<OsStr>>(&mut self, subsystem: T) -> Result<()>
Adds a filter that matches only devices that belong to the given kernel subsystem.
fn match_attribute<T: AsRef<OsStr>, U: AsRef<OsStr>>(
&mut self,
attribute: T,
value: U
) -> Result<()>
&mut self,
attribute: T,
value: U
) -> Result<()>
Adds a filter that matches only devices with the given attribute value.
fn match_sysname<T: AsRef<OsStr>>(&mut self, sysname: T) -> Result<()>
Adds a filter that matches only devices with the given kernel device name.
fn match_property<T: AsRef<OsStr>, U: AsRef<OsStr>>(
&mut self,
property: T,
value: U
) -> Result<()>
&mut self,
property: T,
value: U
) -> Result<()>
Adds a filter that matches only devices with the given property value.
fn match_tag<T: AsRef<OsStr>>(&mut self, tag: T) -> Result<()>
Adds a filter that matches only devices with the given tag.
fn match_parent(&mut self, parent: &Device) -> Result<()>
Includes the parent device and all devices in the subtree of the parent device.
fn nomatch_subsystem<T: AsRef<OsStr>>(&mut self, subsystem: T) -> Result<()>
Adds a filter that matches only devices that don't belong to the given kernel subsystem.
fn nomatch_attribute<T: AsRef<OsStr>, U: AsRef<OsStr>>(
&mut self,
attribute: T,
value: U
) -> Result<()>
&mut self,
attribute: T,
value: U
) -> Result<()>
Adds a filter that matches only devices that don't have the the given attribute value.
fn add_syspath(&mut self, syspath: &Path) -> Result<()>
Includes the device with the given syspath.
fn scan_devices(&mut self) -> Result<Devices>
Scans /sys
for devices matching the attached filters.
The devices will be sorted in dependency order.