pub struct UdevDevice { /* private fields */ }Expand description
Represents one kernel sys device.
Implementations§
Source§impl UdevDevice
impl UdevDevice
Sourcepub fn new(udev: Arc<Udev>) -> Self
pub fn new(udev: Arc<Udev>) -> Self
Creates a new UdevDevice.
Sourcepub fn udev_cloned(&self) -> Arc<Udev>
pub fn udev_cloned(&self) -> Arc<Udev>
Gets a cloned reference to the Udev context.
Sourcepub fn new_from_nulstr(udev: Arc<Udev>, buf: &[u8]) -> Result<Self>
pub fn new_from_nulstr(udev: Arc<Udev>, buf: &[u8]) -> Result<Self>
Creates a new UdevDevice.
Sourcepub fn new_from_syspath(udev: Arc<Udev>, syspath: &str) -> Result<Self>
pub fn new_from_syspath(udev: Arc<Udev>, syspath: &str) -> Result<Self>
Creates new UdevDevice, and fills in information from the sys device and the udev database entry.
The syspath is the absolute path to the device, including the sys mount point.
The initial refcount is 1, and needs to be decremented to release the resources of the udev device.
Returns: a new UdevDevice, or Error, if it does not exist
Sourcepub fn new_from_devnum(
udev: Arc<Udev>,
devtype: &str,
devnum: dev_t,
) -> Result<Self>
pub fn new_from_devnum( udev: Arc<Udev>, devtype: &str, devnum: dev_t, ) -> Result<Self>
Creates new UdevDevice.
From the libudev documentation:
Fills in information from the `sys` device and the udev database entry.
The device is looked-up by its major/minor number and type. Character and block device
numbers are not unique across the two types.Parameters:
udev: Udev library contexttype:charorblockdevicedevnum: device major/minor number
Returns: a new UdevDevice, or Err, if it does not exist
Sourcepub fn new_from_subsystem_sysname(
udev: Arc<Udev>,
subsystem: &str,
sysname: &str,
) -> Result<Self>
pub fn new_from_subsystem_sysname( udev: Arc<Udev>, subsystem: &str, sysname: &str, ) -> Result<Self>
Creates a new UdevDevice from the subsystem and sysname.
From the libudev documentation:
Fills in information from the sys device and the udev database entry.
The device is looked up by the subsystem and name string of the device, like "mem" / "zero", or "block" / "sda".Parameters:
udev: Udev library contextsubsystem: the subsystem of the devicesysname: the name of the device
Returns: a new UdevDevice, or Err, if it does not exist
Sourcepub fn new_from_device_id(udev: Arc<Udev>, id: &str) -> Result<Self>
pub fn new_from_device_id(udev: Arc<Udev>, id: &str) -> Result<Self>
Create new UdevDevice from an ID string.
From the libudev documentation:
Fill in information from the sys device and the udev database entry.
The device is looked-up by a special string:
b8:2 - block device major:minor
c128:1 - char device major:minor
n3 - network device ifindex
+sound:card29 - kernel driver core subsystem:device nameParameters:
udev: udev library contextid: text string identifying a kernel device
Returns: a new UdevDevice, or Err, if it does not exist
Sourcepub fn new_from_environment(udev: Arc<Udev>) -> Result<Self>
pub fn new_from_environment(udev: Arc<Udev>) -> Result<Self>
Create new udev device from the environment information.
From the original libudev documnentation:
Fills in information from the current process environment.
This only works reliable if the process is called from a udev rule.
It is usually used for tools executed from IMPORT= rules.Parameters:
udev: Udev library context
Returns: a new UdevDevice, or Err, if it does not exist
Sourcepub fn new_from_parent(&self) -> Result<Self>
pub fn new_from_parent(&self) -> Result<Self>
Creates a new UdevDevice from the next parent directory in the syspath.
Returns an Err if no parent is found.
Sourcepub fn get_parent(&mut self) -> Result<Arc<Self>>
pub fn get_parent(&mut self) -> Result<Arc<Self>>
Gets the next parent UdevDevice.
From the libudev documentation:
Find the next parent device, and fill in information from the sys
device and the udev database entry.
@udev_device: the device to start searching from
Returned device is not referenced. It is attached to the child
device, and will be cleaned up when the child device is cleaned up.
It is not necessarily just the upper level directory, empty or not
recognized sys directories are ignored.
It can be called as many times as needed, without caring about
references.Returns: a new UdevDevice, or Err, if it no parent exists.
Sourcepub fn get_parent_with_subsystem_devtype(
&mut self,
subsystem: &str,
devtype: &str,
) -> Result<Arc<Self>>
pub fn get_parent_with_subsystem_devtype( &mut self, subsystem: &str, devtype: &str, ) -> Result<Arc<Self>>
Gets the next parent UdevDevice based on subsystem and devtype.
From the libudev documentation:
Find the next parent device, with a matching subsystem and devtype
value, and fill in information from the sys device and the udev
database entry.
If devtype is #NULL, only subsystem is checked, and any devtype will
match.
Returned device is not referenced. It is attached to the child
device, and will be cleaned up when the child device is cleaned up.
It can be called as many times as needed, without caring about
references.Parameters:
udev_device: udev device to start searching fromsubsystem: the subsystem of the devicedevtype: the type (DEVTYPE) of the device
Returns: a new UdevDevice, or Err if no matching parent exists.
Sourcepub const fn parent_set(&self) -> bool
pub const fn parent_set(&self) -> bool
Gets whether a parent UdevDevice is set.
Sourcepub fn syspath(&self) -> &str
pub fn syspath(&self) -> &str
Gets the UdevDevice syspath.
Sourcepub fn set_syspath<P: Into<String>>(&mut self, syspath: P)
pub fn set_syspath<P: Into<String>>(&mut self, syspath: P)
Sets the UdevDevice syspath.
Sourcepub fn with_syspath<P: Into<String>>(self, syspath: P) -> Self
pub fn with_syspath<P: Into<String>>(self, syspath: P) -> Self
Builder function that sets the UdevDevice syspath.
Sourcepub fn devpath(&self) -> &str
pub fn devpath(&self) -> &str
Gets the UdevDevice devpath.
Sourcepub fn set_devpath<P: Into<String>>(&mut self, devpath: P)
pub fn set_devpath<P: Into<String>>(&mut self, devpath: P)
Sets the UdevDevice devpath.
Sourcepub fn with_devpath<P: Into<String>>(self, devpath: P) -> Self
pub fn with_devpath<P: Into<String>>(self, devpath: P) -> Self
Builder function that sets the UdevDevice devpath.
Sourcepub fn sysname(&self) -> &str
pub fn sysname(&self) -> &str
Gets the UdevDevice sysname.
Sourcepub fn set_sysname<P: Into<String>>(&mut self, sysname: P)
pub fn set_sysname<P: Into<String>>(&mut self, sysname: P)
Sets the UdevDevice sysname.
Sourcepub fn with_sysname<P: Into<String>>(self, sysname: P) -> Self
pub fn with_sysname<P: Into<String>>(self, sysname: P) -> Self
Builder function that sets the UdevDevice sysname.
Sourcepub fn sysnum(&self) -> &str
pub fn sysnum(&self) -> &str
Gets the UdevDevice sysnum.
Sourcepub fn set_sysnum<P: Into<String>>(&mut self, sysnum: P)
pub fn set_sysnum<P: Into<String>>(&mut self, sysnum: P)
Sets the UdevDevice sysnum.
Sourcepub fn with_sysnum<P: Into<String>>(self, sysnum: P) -> Self
pub fn with_sysnum<P: Into<String>>(self, sysnum: P) -> Self
Builder function that sets the UdevDevice sysnum.
Sourcepub fn devnode(&self) -> &str
pub fn devnode(&self) -> &str
Gets the UdevDevice devnode.
Sourcepub fn set_devnode<P: Into<String>>(&mut self, devnode: P)
pub fn set_devnode<P: Into<String>>(&mut self, devnode: P)
Sets the UdevDevice devnode.
Sourcepub fn with_devnode<P: Into<String>>(self, devnode: P) -> Self
pub fn with_devnode<P: Into<String>>(self, devnode: P) -> Self
Builder function that sets the UdevDevice devnode.
Sourcepub fn get_devnode(&mut self) -> &str
pub fn get_devnode(&mut self) -> &str
Gets the UdevDevice devnode.
From the libudev documentation:
Retrieve the device node file name belonging to the udev device.
The path is an absolute path, and starts with the device directory.Returns: the device node file name of the UdevDevice, or an empty string if none exists.
Sourcepub const fn devnode_mode(&self) -> Mode
pub const fn devnode_mode(&self) -> Mode
Gets the UdevDevice devnode Mode.
Sourcepub fn set_devnode_mode(&mut self, devnode_mode: Mode)
pub fn set_devnode_mode(&mut self, devnode_mode: Mode)
Sets the UdevDevice devnode Mode.
Sourcepub fn with_devnode_mode(self, devnode_mode: Mode) -> Self
pub fn with_devnode_mode(self, devnode_mode: Mode) -> Self
Builder function sets the UdevDevice devnode Mode.
Sourcepub const fn devnode_gid(&self) -> u32
pub const fn devnode_gid(&self) -> u32
Gets the UdevDevice devnode GID.
Sourcepub fn set_devnode_gid(&mut self, gid: u32)
pub fn set_devnode_gid(&mut self, gid: u32)
Sets the UdevDevice devnode GID.
Sourcepub fn with_devnode_gid(self, gid: u32) -> Self
pub fn with_devnode_gid(self, gid: u32) -> Self
Builder function that sets the UdevDevice devnode GID.
Sourcepub const fn devnode_uid(&self) -> u32
pub const fn devnode_uid(&self) -> u32
Gets the UdevDevice devnode UID.
Sourcepub fn set_devnode_uid(&mut self, uid: u32)
pub fn set_devnode_uid(&mut self, uid: u32)
Sets the UdevDevice devnode UID.
Sourcepub fn with_devnode_uid(self, uid: u32) -> Self
pub fn with_devnode_uid(self, uid: u32) -> Self
Builder function that sets the UdevDevice devnode UID.
Sourcepub fn subsystem(&self) -> &str
pub fn subsystem(&self) -> &str
Gets the UdevDevice subsystem.
Sourcepub fn set_subsystem<P: Into<String>>(&mut self, subsystem: P)
pub fn set_subsystem<P: Into<String>>(&mut self, subsystem: P)
Sets the UdevDevice subsystem.
Sourcepub fn with_subsystem<P: Into<String>>(self, subsystem: P) -> Self
pub fn with_subsystem<P: Into<String>>(self, subsystem: P) -> Self
Builder function that sets the UdevDevice subsystem.
Sourcepub fn get_subsystem(&mut self) -> &str
pub fn get_subsystem(&mut self) -> &str
Retrieves the subsystem string of the udev device.
The string does not contain any “/”.
Returns:
- name of the subsystem of the
udevdevice. - empty string if the subsystem can not be determined.
Sourcepub fn devtype(&self) -> &str
pub fn devtype(&self) -> &str
Gets the UdevDevice devtype.
Sourcepub fn set_devtype<P: Into<String>>(&mut self, devtype: P)
pub fn set_devtype<P: Into<String>>(&mut self, devtype: P)
Sets the UdevDevice devtype.
Sourcepub fn with_devtype<P: Into<String>>(self, devtype: P) -> Self
pub fn with_devtype<P: Into<String>>(self, devtype: P) -> Self
Builder function that sets the UdevDevice devtype.
Sourcepub fn get_devtype(&mut self) -> &str
pub fn get_devtype(&mut self) -> &str
Gets the devtypes string of the UdevDevice.
If the devtype is unset, attempts to read properties from the syspath file.
Sourcepub fn driver(&self) -> &str
pub fn driver(&self) -> &str
Gets the UdevDevice driver.
Sourcepub fn set_driver<P: Into<String>>(&mut self, driver: P)
pub fn set_driver<P: Into<String>>(&mut self, driver: P)
Sets the UdevDevice driver.
Sourcepub fn with_driver<P: Into<String>>(self, driver: P) -> Self
pub fn with_driver<P: Into<String>>(self, driver: P) -> Self
Builder function that sets the UdevDevice driver.
Sourcepub fn get_driver(&mut self) -> Option<&str>
pub fn get_driver(&mut self) -> Option<&str>
Gets the kernel driver name.
Returns: the kernel driver name, or None if none is attached.
Sourcepub fn action(&self) -> &str
pub fn action(&self) -> &str
Gets the UdevDevice action.
Sourcepub fn set_action<P: Into<String>>(&mut self, action: P)
pub fn set_action<P: Into<String>>(&mut self, action: P)
Sets the UdevDevice action.
Sourcepub fn with_action<P: Into<String>>(self, action: P) -> Self
pub fn with_action<P: Into<String>>(self, action: P) -> Self
Builder function that sets the UdevDevice action.
Sourcepub fn devpath_old(&self) -> &str
pub fn devpath_old(&self) -> &str
Gets the UdevDevice devpath_old.
Sourcepub fn set_devpath_old<P: Into<String>>(&mut self, devpath_old: P)
pub fn set_devpath_old<P: Into<String>>(&mut self, devpath_old: P)
Sets the UdevDevice devpath_old.
Sourcepub fn with_devpath_old<P: Into<String>>(self, devpath_old: P) -> Self
pub fn with_devpath_old<P: Into<String>>(self, devpath_old: P) -> Self
Builder function that sets the UdevDevice devpath_old.
Sourcepub fn id_filename(&self) -> &str
pub fn id_filename(&self) -> &str
Gets the UdevDevice id_filename.
Sourcepub fn set_id_filename<P: Into<String>>(&mut self, id_filename: P)
pub fn set_id_filename<P: Into<String>>(&mut self, id_filename: P)
Sets the UdevDevice id_filename.
Sourcepub fn with_id_filename<P: Into<String>>(self, id_filename: P) -> Self
pub fn with_id_filename<P: Into<String>>(self, id_filename: P) -> Self
Builder function that sets the UdevDevice id_filename.
Sourcepub fn get_id_filename(&mut self) -> &str
pub fn get_id_filename(&mut self) -> &str
Gets the ID filename.
If the filename is empty, attempts to set it based on subsystem information.
Returns: the ID filename, or an empty string if none can be constructed.
Sourcepub fn set_envp<P: Into<String> + Clone>(&mut self, envp: &[P])
pub fn set_envp<P: Into<String> + Clone>(&mut self, envp: &[P])
Sets the list of envp arguments.
Sourcepub fn with_envp<P: Into<String> + Clone>(self, envp: &[P]) -> Self
pub fn with_envp<P: Into<String> + Clone>(self, envp: &[P]) -> Self
Builder function that sets the list of envp arguments.
Sourcepub fn envp_is_empty(&self) -> bool
pub fn envp_is_empty(&self) -> bool
Gets whether the envp list is empty.
Sourcepub fn clear_envp(&mut self)
pub fn clear_envp(&mut self)
Clears the envp arguments.
Sourcepub fn monitor_buf(&self) -> &str
pub fn monitor_buf(&self) -> &str
Gets the UdevDevice monitor_buf.
Sourcepub fn set_monitor_buf<P: Into<String>>(&mut self, monitor_buf: P)
pub fn set_monitor_buf<P: Into<String>>(&mut self, monitor_buf: P)
Sets the UdevDevice monitor_buf.
Sourcepub fn with_monitor_buf<P: Into<String>>(self, monitor_buf: P) -> Self
pub fn with_monitor_buf<P: Into<String>>(self, monitor_buf: P) -> Self
Builder function that sets the UdevDevice monitor_buf.
Sourcepub fn get_properties_monitor_buf(&mut self) -> &str
pub fn get_properties_monitor_buf(&mut self) -> &str
Gets the environment properties monitor buffer.
If the environment is not up to date, updates the monitor buffer.
Sourcepub fn update_envp_monitor_buf(&mut self)
pub fn update_envp_monitor_buf(&mut self)
Updates the envp and monitor buffer from the properties list.
Sourcepub const fn devlinks_list(&self) -> &UdevList
pub const fn devlinks_list(&self) -> &UdevList
Gets a reference to the UdevDevice devlinks_list UdevList.
Sourcepub fn devlinks_list_mut(&mut self) -> &mut UdevList
pub fn devlinks_list_mut(&mut self) -> &mut UdevList
Gets a mutable reference to the UdevDevice devlinks_list UdevList.
Sourcepub fn devlinks_list_entry(&self) -> Option<&UdevEntry>
pub fn devlinks_list_entry(&self) -> Option<&UdevEntry>
Gets the next entry in the devlinks list.
Sourcepub fn get_devlinks_list_entry(&mut self) -> Option<&UdevEntry>
pub fn get_devlinks_list_entry(&mut self) -> Option<&UdevEntry>
Gets the list of device links for the UdevDevice.
From the libudev documentation:
Retrieve the list of device links pointing to the device file of
the udev device. The next list entry can be retrieved with
udev_list_entry_get_next(), which returns #NULL if no more entries exist.
The devlink path can be retrieved from the list entry by
udev_list_entry_get_name(). The path is an absolute path, and starts with
the device directory.Returns: the first entry of the device node link list
Sourcepub fn set_devlinks_list<U: Into<UdevEntryList>>(&mut self, devlinks_list: U)
pub fn set_devlinks_list<U: Into<UdevEntryList>>(&mut self, devlinks_list: U)
Sets the UdevDevice devlinks_list UdevList.
Sourcepub fn with_devlinks_list<U: Into<UdevEntryList>>(
self,
devlinks_list: U,
) -> Self
pub fn with_devlinks_list<U: Into<UdevEntryList>>( self, devlinks_list: U, ) -> Self
Builder function sets the UdevDevice UdevList.
Sourcepub fn add_devlink(&mut self, devlink: &str)
pub fn add_devlink(&mut self, devlink: &str)
Adds an UdevEntry to the devlinks list.
Sourcepub const fn properties_list(&self) -> &UdevList
pub const fn properties_list(&self) -> &UdevList
Gets a reference to the UdevDevice properties_list UdevList.
Sourcepub fn properties_list_mut(&mut self) -> &mut UdevList
pub fn properties_list_mut(&mut self) -> &mut UdevList
Gets a mutable reference to the UdevDevice properties_list UdevList.
Sourcepub fn set_properties_list<U: Into<UdevEntryList>>(
&mut self,
properties_list: U,
)
pub fn set_properties_list<U: Into<UdevEntryList>>( &mut self, properties_list: U, )
Sets the UdevDevice properties_list UdevList.
Sourcepub fn with_properties_list<U: Into<UdevEntryList>>(
self,
properties_list: U,
) -> Self
pub fn with_properties_list<U: Into<UdevEntryList>>( self, properties_list: U, ) -> Self
Builder function sets the UdevDevice UdevList.
Sourcepub fn get_property_value(&self, key: &str) -> Option<&str>
pub fn get_property_value(&self, key: &str) -> Option<&str>
Gets the value of a given property.
Sourcepub const fn sysattr_value_list(&self) -> &UdevList
pub const fn sysattr_value_list(&self) -> &UdevList
Gets a reference to the UdevDevice sysattr_value_list UdevList.
Sourcepub fn sysattr_value_list_mut(&mut self) -> &mut UdevList
pub fn sysattr_value_list_mut(&mut self) -> &mut UdevList
Gets a mutable reference to the UdevDevice sysattr_value_list UdevList.
Sourcepub fn set_sysattr_value_list<U: Into<UdevEntryList>>(
&mut self,
sysattr_value_list: U,
)
pub fn set_sysattr_value_list<U: Into<UdevEntryList>>( &mut self, sysattr_value_list: U, )
Sets the UdevDevice sysattr_value_list UdevList.
Sourcepub fn with_sysattr_value_list<U: Into<UdevEntryList>>(
self,
sysattr_value_list: U,
) -> Self
pub fn with_sysattr_value_list<U: Into<UdevEntryList>>( self, sysattr_value_list: U, ) -> Self
Builder function sets the UdevDevice UdevList.
Sourcepub const fn sysattr_list(&self) -> &UdevList
pub const fn sysattr_list(&self) -> &UdevList
Gets a reference to the UdevDevice sysattr_list UdevList.
Sourcepub fn sysattr_list_mut(&mut self) -> &mut UdevList
pub fn sysattr_list_mut(&mut self) -> &mut UdevList
Gets a mutable reference to the UdevDevice sysattr_list UdevList.
Sourcepub fn set_sysattr_list<U: Into<UdevEntryList>>(&mut self, sysattr_list: U)
pub fn set_sysattr_list<U: Into<UdevEntryList>>(&mut self, sysattr_list: U)
Sets the UdevDevice sysattr_list UdevList.
Sourcepub fn with_sysattr_list<U: Into<UdevEntryList>>(self, sysattr_list: U) -> Self
pub fn with_sysattr_list<U: Into<UdevEntryList>>(self, sysattr_list: U) -> Self
Builder function sets the UdevDevice UdevList.
Sourcepub fn get_sysattr_list_entry(&mut self) -> Option<&UdevEntry>
pub fn get_sysattr_list_entry(&mut self) -> Option<&UdevEntry>
Gets the first entry in the sysattr properties list.
From the libudev documentation:
Retrieve the list of available sysattrs, with value being empty;
This just return all available sysfs attributes for a particular
device without reading their values.Returns: the first entry of the property list
Sourcepub fn get_sysattr_value(&mut self, sysattr: &str) -> Option<String>
pub fn get_sysattr_value(&mut self, sysattr: &str) -> Option<String>
Gets the sys attribute file value.
From the libudev documentation:
The retrieved value is cached in the device. Repeated calls will return the same
value and not open the attribute again.Returns: the content of a sys attribute file, or None if there is no sys attribute value.
Gets a reference to the UdevDevice tags_list UdevList.
Gets a mutable reference to the UdevDevice tags_list UdevList.
Sets the UdevDevice tags_list UdevList.
Builder function sets the UdevDevice UdevList.
Gets the first tags list entry in the UdevDevice.
Gets the first tags list entry in the UdevDevice.
From the libudev documentation:
Retrieve the list of tags attached to the udev device. The next
list entry can be retrieved with udev_list_entry_get_next(),
which returns `None` if no more entries exist. The tag string
can be retrieved from the list entry by udev_list_entry_get_name().Returns: the first entry of the tag list
Gets the current tags list entry in the UdevDevice.
From the libudev documentation:
Retrieve the list of tags attached to the udev device. The next
list entry can be retrieved with udev_list_entry_get_next(),
which returns `None` if no more entries exist. The tag string
can be retrieved from the list entry by udev_list_entry_get_name().Returns: the current entry of the tag list
Sourcepub fn has_tag(&mut self, tag: &str) -> bool
pub fn has_tag(&mut self, tag: &str) -> bool
Gets whether the UdevDevice has the provided tag associated.
From the libudev documentation:
Check if a given device has a certain tag associated.Sourcepub const fn seqnum(&self) -> u64
pub const fn seqnum(&self) -> u64
Gets the UdevDevice seqnum.
Sourcepub fn set_seqnum(&mut self, seqnum: u64)
pub fn set_seqnum(&mut self, seqnum: u64)
Sets the UdevDevice seqnum.
Sourcepub fn with_seqnum(self, seqnum: u64) -> Self
pub fn with_seqnum(self, seqnum: u64) -> Self
Builder function sets the UdevDevice seqnum.
Sourcepub const fn usec_initialized(&self) -> u64
pub const fn usec_initialized(&self) -> u64
Gets the UdevDevice usec_initialized.
Sourcepub fn set_usec_initialized(&mut self, usec_initialized: u64)
pub fn set_usec_initialized(&mut self, usec_initialized: u64)
Sets the UdevDevice usec_initialized.
Sourcepub fn with_usec_initialized(self, usec_initialized: u64) -> Self
pub fn with_usec_initialized(self, usec_initialized: u64) -> Self
Builder function sets the UdevDevice usec_initialized.
Sourcepub fn get_usec_since_initialized(&mut self) -> u64
pub fn get_usec_since_initialized(&mut self) -> u64
Gets the number of microseconds since the UdevDevice was initialized.
From the libudev documentation:
Return the number of microseconds passed since udev set up the
device for the first time.
This is only implemented for devices with need to store properties
in the udev database. All other devices return 0 here.Returns: the number of microseconds since the device was first seen.
Sourcepub const fn devlink_priority(&self) -> i32
pub const fn devlink_priority(&self) -> i32
Gets the UdevDevice devlink priority.
Sourcepub fn set_devlink_priority(&mut self, devlink_priority: i32)
pub fn set_devlink_priority(&mut self, devlink_priority: i32)
Sets the UdevDevice devlink priority.
Sourcepub fn with_devlink_priority(self, devlink_priority: i32) -> Self
pub fn with_devlink_priority(self, devlink_priority: i32) -> Self
Builder function sets the UdevDevice devlink priority.
Sourcepub const fn devnum(&self) -> u64
pub const fn devnum(&self) -> u64
Gets the UdevDevice devnum.
Sourcepub fn set_devnum(&mut self, devnum: u64)
pub fn set_devnum(&mut self, devnum: u64)
Sets the UdevDevice devnum.
Sourcepub fn with_devnum(self, devnum: u64) -> Self
pub fn with_devnum(self, devnum: u64) -> Self
Builder function sets the UdevDevice devnum.
Sourcepub fn get_devnum(&mut self) -> u64
pub fn get_devnum(&mut self) -> u64
Gets the device major/minor number.
Sourcepub const fn ifindex(&self) -> i32
pub const fn ifindex(&self) -> i32
Gets the UdevDevice ifindex.
Sourcepub fn set_ifindex(&mut self, ifindex: i32)
pub fn set_ifindex(&mut self, ifindex: i32)
Sets the UdevDevice ifindex.
Sourcepub fn with_ifindex(self, ifindex: i32) -> Self
pub fn with_ifindex(self, ifindex: i32) -> Self
Builder function sets the UdevDevice ifindex.
Sourcepub fn get_ifindex(&mut self) -> i32
pub fn get_ifindex(&mut self) -> i32
Gets the UdevDevice ifindex.
If the information file is not loaded, reads and parses the file from disk.
Sourcepub const fn watch_handle(&self) -> i32
pub const fn watch_handle(&self) -> i32
Gets the UdevDevice watch handle.
Sourcepub fn set_watch_handle(&mut self, watch_handle: i32)
pub fn set_watch_handle(&mut self, watch_handle: i32)
Sets the UdevDevice watch handle.
Sourcepub fn with_watch_handle(self, watch_handle: i32) -> Self
pub fn with_watch_handle(self, watch_handle: i32) -> Self
Builder function sets the UdevDevice watch handle.
Sourcepub const fn maj(&self) -> i32
pub const fn maj(&self) -> i32
Gets the UdevDevice major number.
Sourcepub fn set_maj(&mut self, maj: i32)
pub fn set_maj(&mut self, maj: i32)
Sets the UdevDevice major number.
Sourcepub fn with_maj(self, maj: i32) -> Self
pub fn with_maj(self, maj: i32) -> Self
Builder function sets the UdevDevice major number.
Sourcepub const fn min(&self) -> i32
pub const fn min(&self) -> i32
Gets the UdevDevice minor number.
Sourcepub fn set_min(&mut self, min: i32)
pub fn set_min(&mut self, min: i32)
Sets the UdevDevice minor number.
Sourcepub fn with_min(self, min: i32) -> Self
pub fn with_min(self, min: i32) -> Self
Builder function sets the UdevDevice minor number.
Sourcepub const fn devlinks_uptodate(&self) -> bool
pub const fn devlinks_uptodate(&self) -> bool
Gets the UdevDevice devlinks up-to-date.
Sourcepub fn set_devlinks_uptodate(&mut self, devlinks_uptodate: bool)
pub fn set_devlinks_uptodate(&mut self, devlinks_uptodate: bool)
Sets the UdevDevice devlinks up-to-date.
Sourcepub fn with_devlinks_uptodate(self, devlinks_uptodate: bool) -> Self
pub fn with_devlinks_uptodate(self, devlinks_uptodate: bool) -> Self
Builder function sets the UdevDevice devlinks up-to-date.
Sourcepub const fn envp_uptodate(&self) -> bool
pub const fn envp_uptodate(&self) -> bool
Gets the UdevDevice envp up-to-date.
Sourcepub fn set_envp_uptodate(&mut self, envp_uptodate: bool)
pub fn set_envp_uptodate(&mut self, envp_uptodate: bool)
Sets the UdevDevice envp up-to-date.
Sourcepub fn with_envp_uptodate(self, envp_uptodate: bool) -> Self
pub fn with_envp_uptodate(self, envp_uptodate: bool) -> Self
Builder function sets the UdevDevice envp up-to-date.
Gets the UdevDevice tags up-to-date.
Sets the UdevDevice tags up-to-date.
Builder function sets the UdevDevice tags up-to-date.
Sourcepub const fn info_loaded(&self) -> bool
pub const fn info_loaded(&self) -> bool
Gets the UdevDevice info loaded.
Sourcepub fn set_info_loaded(&mut self, info_loaded: bool)
pub fn set_info_loaded(&mut self, info_loaded: bool)
Sets the UdevDevice info loaded.
Sourcepub fn with_info_loaded(self, info_loaded: bool) -> Self
pub fn with_info_loaded(self, info_loaded: bool) -> Self
Builder function sets the UdevDevice info loaded.
Sourcepub const fn db_loaded(&self) -> bool
pub const fn db_loaded(&self) -> bool
Gets the UdevDevice db loaded.
Sourcepub fn set_db_loaded(&mut self, db_loaded: bool)
pub fn set_db_loaded(&mut self, db_loaded: bool)
Sets the UdevDevice db loaded.
Sourcepub fn with_db_loaded(self, db_loaded: bool) -> Self
pub fn with_db_loaded(self, db_loaded: bool) -> Self
Builder function sets the UdevDevice db loaded.
Sourcepub const fn uevent_loaded(&self) -> bool
pub const fn uevent_loaded(&self) -> bool
Gets the UdevDevice uevent loaded.
Sourcepub fn set_uevent_loaded(&mut self, uevent_loaded: bool)
pub fn set_uevent_loaded(&mut self, uevent_loaded: bool)
Sets the UdevDevice uevent loaded.
Sourcepub fn with_uevent_loaded(self, uevent_loaded: bool) -> Self
pub fn with_uevent_loaded(self, uevent_loaded: bool) -> Self
Builder function sets the UdevDevice uevent loaded.
Sourcepub const fn is_initialized(&self) -> bool
pub const fn is_initialized(&self) -> bool
Gets the UdevDevice is initialized.
Sourcepub fn set_is_initialized(&mut self, is_initialized: bool)
pub fn set_is_initialized(&mut self, is_initialized: bool)
Sets the UdevDevice is initialized.
Sourcepub fn with_is_initialized(self, is_initialized: bool) -> Self
pub fn with_is_initialized(self, is_initialized: bool) -> Self
Builder function sets the UdevDevice is initialized.
Sourcepub fn get_is_initialized(&mut self) -> bool
pub fn get_is_initialized(&mut self) -> bool
Gets whether the UdevDevice is initialized.
From the libudev documentation:
Check if udev has already handled the device and has set up
device node permissions and context, or has renamed a network
device.
This is only implemented for devices with a device node
or network interfaces. All other devices return 1 here.Sourcepub const fn sysattr_list_read(&self) -> bool
pub const fn sysattr_list_read(&self) -> bool
Gets the UdevDevice sysattr list read.
Sourcepub fn set_sysattr_list_read(&mut self, sysattr_list_read: bool)
pub fn set_sysattr_list_read(&mut self, sysattr_list_read: bool)
Sets the UdevDevice sysattr list read.
Sourcepub fn with_sysattr_list_read(self, sysattr_list_read: bool) -> Self
pub fn with_sysattr_list_read(self, sysattr_list_read: bool) -> Self
Builder function sets the UdevDevice sysattr list read.
pub fn get_sysattr_list_read(&mut self) -> Result<usize>
Sourcepub const fn db_persist(&self) -> bool
pub const fn db_persist(&self) -> bool
Gets the UdevDevice database persist.
Sourcepub fn set_db_persist(&mut self, db_persist: bool)
pub fn set_db_persist(&mut self, db_persist: bool)
Sets the UdevDevice database persist.
Sourcepub fn with_db_persist(self, db_persist: bool) -> Self
pub fn with_db_persist(self, db_persist: bool) -> Self
Builder function sets the UdevDevice database persist.
Sourcepub fn read_db(&mut self) -> Result<()>
pub fn read_db(&mut self) -> Result<()>
Reads UdevDevice information from the persistent database file.
Returns: Ok(()) on success, Err(Error) otherwise
Sourcepub fn read_uevent_file(&mut self) -> Result<()>
pub fn read_uevent_file(&mut self) -> Result<()>
Reads properties from the uevent file.
Sourcepub fn add_property_from_string(&mut self, property: &str) -> Option<&UdevEntry>
pub fn add_property_from_string(&mut self, property: &str) -> Option<&UdevEntry>
Parses the property string, and adds an UdevEntry to the properties list.
Sourcepub fn add_property_from_string_parse(&mut self, property: &str) -> Result<()>
pub fn add_property_from_string_parse(&mut self, property: &str) -> Result<()>
Parses property string, and if needed, updates internal values accordingly.
From libudev documentation:
add_property_from_string_parse_finish() needs to be called after adding properties, and its return value checked.
set_info_loaded() needs to be set, to avoid trying
to use a device without a DEVPATH set.
Sourcepub fn add_property_from_string_parse_finish(&mut self) -> Result<()>
pub fn add_property_from_string_parse_finish(&mut self) -> Result<()>
Finishes adding property information after parsing configuration string.
NOTE users should call this function after the final call to (add_property_from_string_parse)Self::add_property_from_string_parse.
Trait Implementations§
Source§impl Clone for UdevDevice
impl Clone for UdevDevice
Source§fn clone(&self) -> UdevDevice
fn clone(&self) -> UdevDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more