Device

Trait Device 

Source
pub trait Device:
    Send
    + Sync
    + ControlOps
    + MemoryMappingOps
    + Selectable {
Show 14 methods // Required methods fn device_type(&self) -> DeviceType; fn name(&self) -> &'static str; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; // Provided methods fn capabilities(&self) -> &'static [DeviceCapability] { ... } fn as_event_capable(&self) -> Option<&dyn EventCapableDevice> { ... } fn as_char_device(&self) -> Option<&dyn CharDevice> { ... } fn as_block_device(&self) -> Option<&dyn BlockDevice> { ... } fn as_graphics_device(&self) -> Option<&dyn GraphicsDevice> { ... } fn as_network_device(&self) -> Option<&dyn NetworkDevice> { ... } fn into_block_device(self: Arc<Self>) -> Option<Arc<dyn BlockDevice>> { ... } fn into_char_device(self: Arc<Self>) -> Option<Arc<dyn CharDevice>> { ... } fn into_graphics_device(self: Arc<Self>) -> Option<Arc<dyn GraphicsDevice>> { ... } fn into_network_device(self: Arc<Self>) -> Option<Arc<dyn NetworkDevice>> { ... }
}
Expand description

Device trait.

This trait defines the interface for devices in the kernel. Device IDs are assigned by DeviceManager when devices are registered. All devices must support control operations through the ControlOps trait and memory mapping operations through the MemoryMappingOps trait.

Required Methods§

Source

fn device_type(&self) -> DeviceType

Source

fn name(&self) -> &'static str

Source

fn as_any(&self) -> &dyn Any

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Provided Methods§

Source

fn capabilities(&self) -> &'static [DeviceCapability]

Optional capabilities exposed by this device (default: none)

Source

fn as_event_capable(&self) -> Option<&dyn EventCapableDevice>

Cast to EventCapableDevice if this device can emit events

Source

fn as_char_device(&self) -> Option<&dyn CharDevice>

Cast to CharDevice if this device is a character device

Source

fn as_block_device(&self) -> Option<&dyn BlockDevice>

Cast to BlockDevice if this device is a block device

Source

fn as_graphics_device(&self) -> Option<&dyn GraphicsDevice>

Cast to GraphicsDevice if this device is a graphics device

Source

fn as_network_device(&self) -> Option<&dyn NetworkDevice>

Cast to NetworkDevice if this device is a network device

Source

fn into_block_device(self: Arc<Self>) -> Option<Arc<dyn BlockDevice>>

Cast Arc to Arc if this device is a block device This allows direct ownership of the block device for efficient I/O operations

Source

fn into_char_device(self: Arc<Self>) -> Option<Arc<dyn CharDevice>>

Cast Arc to Arc if this device is a character device This allows direct ownership of the char device for efficient I/O operations

Source

fn into_graphics_device(self: Arc<Self>) -> Option<Arc<dyn GraphicsDevice>>

Cast Arc to Arc if this device is a graphics device This allows direct ownership of the graphics device for efficient operations

Source

fn into_network_device(self: Arc<Self>) -> Option<Arc<dyn NetworkDevice>>

Cast Arc to Arc if this device is a network device This allows direct ownership of the network device for efficient operations

Implementors§