Trait Adapter

Source
pub trait Adapter {
    type IdInfo: 'static;

    // Required method
    fn of_id_table() -> Option<IdTable<Self::IdInfo>>;

    // Provided methods
    fn of_id_info(dev: &Device) -> Option<&'static Self::IdInfo> { ... }
    fn id_info(dev: &Device) -> Option<&'static Self::IdInfo> { ... }
}
Expand description

The bus independent adapter to match a drivers and a devices.

This trait should be implemented by the bus specific adapter, which represents the connection of a device and a driver.

It provides bus independent functions for device / driver interactions.

Required Associated Types§

Source

type IdInfo: 'static

The type holding driver private data about each device id supported by the driver.

Required Methods§

Source

fn of_id_table() -> Option<IdTable<Self::IdInfo>>

The of::IdTable of the corresponding driver.

Provided Methods§

Source

fn of_id_info(dev: &Device) -> Option<&'static Self::IdInfo>

Returns the driver’s private data from the matching entry in the of::IdTable, if any.

If this returns None, it means there is no match with an entry in the of::IdTable.

Source

fn id_info(dev: &Device) -> Option<&'static Self::IdInfo>

Returns the driver’s private data from the matching entry of any of the ID tables, if any.

If this returns None, it means that there is no match in any of the ID tables directly associated with a device::Device.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Driver + 'static> Adapter for Adapter<T>