UdevHwdb

Struct UdevHwdb 

Source
pub struct UdevHwdb { /* private fields */ }
Expand description

Represents the on-disk hardware database.

Retrieves properties from the hardware database.

Implementations§

Source§

impl UdevHwdb

Source

pub fn new(udev: Arc<Udev>) -> Result<Self>

Creates a new UdevHwdb.

Source

pub const fn header(&self) -> &TrieHeader

Gets a reference to the TrieHeader.

Source

pub fn get_properties_list_entry( &mut self, modalias: &str, _flags: u32, ) -> Option<&UdevEntry>

Looks up a matching device in the hardware database.

Parameters:

  • modalias: modalias string
  • flags: (unused), preserved for easier mapping to libudev C API

From the libudev documentation:

The lookup key is a `modalias` string, whose formats are defined for the Linux kernel modules.
Examples are: pci:v00008086d00001C2D*, usb:v04F2pB221*. The first entry
of a list of retrieved properties is returned.

Returns: an optional reference to an UdevEntry.

Source

pub fn query(&mut self, modalias: &str) -> Option<&UdevList>

Looks up a matching device modalias in the hardware database and returns the list of properties.

Source

pub const fn properties_list(&self) -> &UdevList

Gets a reference to the properties list.

Source

pub fn add_property(&mut self, key: &str, value: &str) -> Result<()>

Adds a key-value pair to the property list.

Source

pub fn parse_nodes<'a>( head: &'a TrieHeader, hwdb_buf: &'a [u8], ) -> impl Iterator<Item = TrieEntry> + 'a

Parses all TrieEntry nodes from an in-memory HWDB buffer.

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
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> 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, 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.