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§
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§
Sourcefn capabilities(&self) -> &'static [DeviceCapability]
fn capabilities(&self) -> &'static [DeviceCapability]
Optional capabilities exposed by this device (default: none)
Sourcefn as_event_capable(&self) -> Option<&dyn EventCapableDevice>
fn as_event_capable(&self) -> Option<&dyn EventCapableDevice>
Cast to EventCapableDevice if this device can emit events
Sourcefn as_char_device(&self) -> Option<&dyn CharDevice>
fn as_char_device(&self) -> Option<&dyn CharDevice>
Cast to CharDevice if this device is a character device
Sourcefn as_block_device(&self) -> Option<&dyn BlockDevice>
fn as_block_device(&self) -> Option<&dyn BlockDevice>
Cast to BlockDevice if this device is a block device
Sourcefn as_graphics_device(&self) -> Option<&dyn GraphicsDevice>
fn as_graphics_device(&self) -> Option<&dyn GraphicsDevice>
Cast to GraphicsDevice if this device is a graphics device
Sourcefn as_network_device(&self) -> Option<&dyn NetworkDevice>
fn as_network_device(&self) -> Option<&dyn NetworkDevice>
Cast to NetworkDevice if this device is a network device
Sourcefn into_block_device(self: Arc<Self>) -> Option<Arc<dyn BlockDevice>>
fn into_block_device(self: Arc<Self>) -> Option<Arc<dyn BlockDevice>>
Cast Arc
Sourcefn into_char_device(self: Arc<Self>) -> Option<Arc<dyn CharDevice>>
fn into_char_device(self: Arc<Self>) -> Option<Arc<dyn CharDevice>>
Cast Arc
Sourcefn into_graphics_device(self: Arc<Self>) -> Option<Arc<dyn GraphicsDevice>>
fn into_graphics_device(self: Arc<Self>) -> Option<Arc<dyn GraphicsDevice>>
Cast Arc
Sourcefn into_network_device(self: Arc<Self>) -> Option<Arc<dyn NetworkDevice>>
fn into_network_device(self: Arc<Self>) -> Option<Arc<dyn NetworkDevice>>
Cast Arc