Driver

Trait Driver 

Source
pub trait Driver: Send + Sync {
    // Required methods
    fn try_handle_interrupt(&self, irq: Option<usize>) -> bool;
    fn device_type(&self) -> DeviceType;
    fn get_id(&self) -> String;

    // Provided methods
    fn as_net(&self) -> Option<&dyn NetDevice> { ... }
    fn as_net_arc(self: Arc<Self>) -> Option<Arc<dyn NetDevice>> { ... }
    fn as_block(&self) -> Option<&dyn BlockDriver> { ... }
    fn as_block_arc(self: Arc<Self>) -> Option<Arc<dyn BlockDriver>> { ... }
    fn as_rtc(&self) -> Option<&dyn RtcDriver> { ... }
    fn as_rtc_arc(self: Arc<Self>) -> Option<Arc<dyn RtcDriver>> { ... }
    fn as_serial(&self) -> Option<&dyn SerialDriver> { ... }
}
Expand description

设备驱动程序特征

Required Methods§

Source

fn try_handle_interrupt(&self, irq: Option<usize>) -> bool

Source

fn device_type(&self) -> DeviceType

Source

fn get_id(&self) -> String

Provided Methods§

Source

fn as_net(&self) -> Option<&dyn NetDevice>

将驱动程序转换为网络驱动程序(如果适用)

Source

fn as_net_arc(self: Arc<Self>) -> Option<Arc<dyn NetDevice>>

将驱动程序转换为网络驱动程序 Arc(如果适用)

Source

fn as_block(&self) -> Option<&dyn BlockDriver>

将驱动程序转换为块设备驱动程序(如果适用)

Source

fn as_block_arc(self: Arc<Self>) -> Option<Arc<dyn BlockDriver>>

将驱动程序转换为块设备驱动程序 Arc(如果适用)

Source

fn as_rtc(&self) -> Option<&dyn RtcDriver>

将驱动程序转换为实时时钟驱动程序(如果适用)

Source

fn as_rtc_arc(self: Arc<Self>) -> Option<Arc<dyn RtcDriver>>

将驱动程序转换为实时时钟驱动程序 Arc(如果适用)

Source

fn as_serial(&self) -> Option<&dyn SerialDriver>

将驱动程序转换为串口驱动程序(如果适用)

Implementors§