pub struct GenericCharDevice {
id: usize,
device_name: &'static str,
read_fn: fn() -> Option<u8>,
write_fn: fn(u8) -> Result<(), &'static str>,
can_read_fn: fn() -> bool,
can_write_fn: fn() -> bool,
}
Expand description
A generic implementation of a character device
Fields§
§id: usize
§device_name: &'static str
§read_fn: fn() -> Option<u8>
§write_fn: fn(u8) -> Result<(), &'static str>
§can_read_fn: fn() -> bool
§can_write_fn: fn() -> bool
Implementations§
Trait Implementations§
Source§impl CharDevice for GenericCharDevice
impl CharDevice for GenericCharDevice
Source§fn write_byte(&mut self, byte: u8) -> Result<(), &'static str>
fn write_byte(&mut self, byte: u8) -> Result<(), &'static str>
Write a single byte to the device Read more
Source§impl Device for GenericCharDevice
impl Device for GenericCharDevice
fn device_type(&self) -> DeviceType
fn name(&self) -> &'static str
fn id(&self) -> usize
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn as_char_device(&mut self) -> Option<&mut dyn CharDevice>
fn as_char_device(&mut self) -> Option<&mut dyn CharDevice>
Cast to CharDevice if this device is a character device
Source§fn as_block_device(&mut self) -> Option<&mut dyn BlockDevice>
fn as_block_device(&mut self) -> Option<&mut dyn BlockDevice>
Cast to BlockDevice if this device is a block device