[−][src]Struct libudev::Event
An event that indicates a change in device state.
Implementations
impl Event
[src]
pub fn event_type(&self) -> EventType
[src]
Returns the EventType
corresponding to this event.
pub fn sequence_number(&self) -> u64
[src]
Returns the event's sequence number.
pub fn device(&self) -> &Device
[src]
Returns the device associated with this event.
Methods from Deref<Target = Device>
pub fn is_initialized(&self) -> bool
[src]
Checks whether the device has already been handled by udev.
When a new device is connected to the system, udev initializes the device by setting
permissions, renaming network devices, and possibly other initialization routines. This
method returns true
if udev has performed all of its work to initialize this device.
This method only applies to devices with device nodes or network interfaces. All other
devices return true
by default.
pub fn devnum(&self) -> Option<dev_t>
[src]
Gets the device's major/minor number.
pub fn syspath(&self) -> Option<&Path>
[src]
Returns the syspath of the device.
The path is an absolute path and includes the sys mount point. For example, the syspath for
tty0
could be /sys/devices/virtual/tty/tty0
, which includes the sys mount point,
/sys
.
pub fn devpath(&self) -> Option<&OsStr>
[src]
Returns the kernel devpath value of the device.
The path does not contain the sys mount point, but does start with a /
. For example, the
devpath for tty0
could be /devices/virtual/tty/tty0
.
pub fn devnode(&self) -> Option<&Path>
[src]
Returns the path to the device node belonging to the device.
The path is an absolute path and starts with the device directory. For example, the device
node for tty0
could be /dev/tty0
.
pub fn parent(&self) -> Option<Device>
[src]
Returns the parent of the device.
pub fn subsystem(&self) -> Option<&OsStr>
[src]
Returns the subsystem name of the device.
The subsystem name is a string that indicates which kernel subsystem the device belongs to.
Examples of subsystem names are tty
, vtconsole
, block
, scsi
, and net
.
pub fn sysname(&self) -> Option<&OsStr>
[src]
Returns the kernel device name for the device.
The sysname is a string that differentiates the device from others in the same subsystem.
For example, tty0
is the sysname for a TTY device that differentiates it from others,
such as tty1
.
pub fn sysnum(&self) -> Option<usize>
[src]
Returns the instance number of the device.
The instance number is used to differentiate many devices of the same type. For example,
/dev/tty0
and /dev/tty1
are both TTY devices but have instance numbers of 0 and 1,
respectively.
Some devices don't have instance numbers, such as /dev/console
, in which case the method
returns None
.
pub fn devtype(&self) -> Option<&OsStr>
[src]
Returns the devtype name of the device.
pub fn driver(&self) -> Option<&OsStr>
[src]
Returns the name of the kernel driver attached to the device.
pub fn property_value<T: AsRef<OsStr>>(&self, property: T) -> Option<&OsStr>
[src]
Retrieves the value of a device property.
pub fn attribute_value<T: AsRef<OsStr>>(&self, attribute: T) -> Option<&OsStr>
[src]
Retrieves the value of a device attribute.
pub fn properties(&self) -> Properties<'_>ⓘNotable traits for Properties<'a>
impl<'a> Iterator for Properties<'a> type Item = Property<'a>;
[src]
Notable traits for Properties<'a>
impl<'a> Iterator for Properties<'a> type Item = Property<'a>;
Returns an iterator over the device's properties.
Example
This example prints out all of a device's properties:
for property in device.properties() { println!("{:?} = {:?}", property.name(), property.value()); }
pub fn attributes(&self) -> Attributes<'_>ⓘNotable traits for Attributes<'a>
impl<'a> Iterator for Attributes<'a> type Item = Attribute<'a>;
[src]
Notable traits for Attributes<'a>
impl<'a> Iterator for Attributes<'a> type Item = Attribute<'a>;
Returns an iterator over the device's attributes.
Example
This example prints out all of a device's attributes:
for attribute in device.attributes() { println!("{:?} = {:?}", attribute.name(), attribute.value()); }
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Event
impl !Send for Event
impl !Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,