pub struct PeripheralDevice<H> { /* private fields */ }Expand description
Character device exposing a PeripheralHandle through the VFS polling contract.
Opening is exclusive: while one opening is held, another open returns
IoErrorKind::ResourceBusy. The exclusivity is released by close on the
opening’s own context. A context created by clone_context does not own
the device. Read, write, flush and control never return Pending; they run
once through ready and return WouldBlock if the handle is in use.
Reads and writes ignore the absolute position because the device is a stream.
Implementations§
Source§impl<H: PeripheralHandle> PeripheralDevice<H>
impl<H: PeripheralHandle> PeripheralDevice<H>
Trait Implementations§
Source§impl<H: PeripheralHandle> BaseOperations for PeripheralDevice<H>
impl<H: PeripheralHandle> BaseOperations for PeripheralDevice<H>
fn open(&self, context: &mut Context) -> Result<()>
fn close(&self, context: &mut Context) -> Result<()>
fn read( &self, _: &mut Context, _cx: &mut Context<'_>, buffer: &mut [u8], _absolute_position: Size, ) -> Poll<Result<usize>>
fn write( &self, _: &mut Context, _cx: &mut Context<'_>, buffer: &[u8], _absolute_position: Size, ) -> Poll<Result<usize>>
fn flush(&self, _: &mut Context, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn control( &self, _: &mut Context, _cx: &mut Context<'_>, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Poll<Result<()>>
fn clone_context(&self, _: &Context) -> Result<Context>
fn read_until( &self, context: &mut Context, cx: &mut Context<'_>, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Poll<Result<usize, Kind>>
fn write_pattern( &self, context: &mut Context, cx: &mut Context<'_>, pattern: &[u8], count: usize, absolute_position: u64, ) -> Poll<Result<usize, Kind>>
fn write_vectored( &self, context: &mut Context, cx: &mut Context<'_>, buffers: &[&[u8]], absolute_position: u64, ) -> Poll<Result<usize, Kind>>
fn read_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, ) -> Result<usize, Kind>
fn write_sync( &self, context: &mut Context, buffer: &[u8], absolute_position: u64, ) -> Result<usize, Kind>
fn flush_sync(&self, context: &mut Context) -> Result<(), Kind>
fn control_sync( &self, context: &mut Context, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<(), Kind>
fn read_until_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: u64, delimiter: &[u8], ) -> Result<usize, Kind>
fn write_pattern_sync( &self, context: &mut Context, pattern: &[u8], count: usize, absolute_position: u64, ) -> Result<usize, Kind>
fn write_vectored_sync( &self, context: &mut Context, buffers: &[&[u8]], absolute_position: u64, ) -> Result<usize, Kind>
§fn cancel_operation(&self, _context: &mut Context, _operation: Operation)
fn cancel_operation(&self, _context: &mut Context, _operation: Operation)
Detach this opening’s registration after completion, error or cancellation.
This hook is idempotent and must not consume data or change the cursor.
Wake and drop retired wakers outside device locks.
fn set_position( &self, _context: &mut Context, current: u64, position: &Position, ) -> Result<u64, Kind>
Source§impl<H: PeripheralHandle> CharacterDevice for PeripheralDevice<H>
impl<H: PeripheralHandle> CharacterDevice for PeripheralDevice<H>
§fn readiness(
&self,
_interests: ReadyEvents,
) -> Result<Option<ReadyEvents>, Kind>
fn readiness( &self, _interests: ReadyEvents, ) -> Result<Option<ReadyEvents>, Kind>
Snapshot device readiness without consuming data. Return
None to use
the VFS fallback, which reports the requested read/write directions
allowed by the opening’s access mode. I/O on such devices may still suspend. Read moreAuto Trait Implementations§
impl<H> !Freeze for PeripheralDevice<H>
impl<H> !RefUnwindSafe for PeripheralDevice<H>
impl<H> Send for PeripheralDevice<H>where
H: Send,
impl<H> Sync for PeripheralDevice<H>where
H: Send,
impl<H> Unpin for PeripheralDevice<H>where
H: Unpin,
impl<H> UnsafeUnpin for PeripheralDevice<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for PeripheralDevice<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more