Skip to main content

BaseOperations

Trait BaseOperations 

Source
pub trait BaseOperations: Send + Sync {
Show 19 methods // Required methods fn read( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, ) -> Poll<Result<usize>>; fn write( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &[u8], absolute_position: Size, ) -> Poll<Result<usize>>; fn clone_context(&self, context: &Context) -> Result<Context>; // Provided methods fn flush( &self, _context: &mut Context, _cx: &mut TaskContext<'_>, ) -> Poll<Result<()>> { ... } fn control( &self, _context: &mut Context, _cx: &mut TaskContext<'_>, _command: ControlCommandIdentifier, _input: &AnyByLayout, _output: &mut AnyByLayout, ) -> Poll<Result<()>> { ... } fn read_until( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Poll<Result<usize>> { ... } fn write_pattern( &self, context: &mut Context, cx: &mut TaskContext<'_>, pattern: &[u8], count: usize, absolute_position: Size, ) -> Poll<Result<usize>> { ... } fn write_vectored( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffers: &[&[u8]], absolute_position: Size, ) -> Poll<Result<usize>> { ... } fn read_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: Size, ) -> Result<usize> { ... } fn write_sync( &self, context: &mut Context, buffer: &[u8], absolute_position: Size, ) -> Result<usize> { ... } fn flush_sync(&self, context: &mut Context) -> Result<()> { ... } fn control_sync( &self, context: &mut Context, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<()> { ... } fn read_until_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Result<usize> { ... } fn write_pattern_sync( &self, context: &mut Context, pattern: &[u8], count: usize, absolute_position: Size, ) -> Result<usize> { ... } fn write_vectored_sync( &self, context: &mut Context, buffers: &[&[u8]], absolute_position: Size, ) -> Result<usize> { ... } fn cancel_operation(&self, _context: &mut Context, _operation: Operation) { ... } fn open(&self, _context: &mut Context) -> Result<()> { ... } fn close(&self, _context: &mut Context) -> Result<()> { ... } fn set_position( &self, _context: &mut Context, current: Size, position: &Position, ) -> Result<Size> { ... }
}
Expand description

Device operations return Poll directly, including read. Pending requires race-free waker registration and must not hide consumed bytes. Never retain caller buffers or task-context pointers. Device-owned state belongs in the opening context (or the device for context-free implementations).

_sync methods are explicit single-attempt adapters for synchronous C/OS boundaries. They cancel registrations and return busy on Pending, never retry.

Required Methods§

Source

fn read( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, ) -> Poll<Result<usize>>

Source

fn write( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &[u8], absolute_position: Size, ) -> Poll<Result<usize>>

Source

fn clone_context(&self, context: &Context) -> Result<Context>

Provided Methods§

Source

fn flush( &self, _context: &mut Context, _cx: &mut TaskContext<'_>, ) -> Poll<Result<()>>

Source

fn control( &self, _context: &mut Context, _cx: &mut TaskContext<'_>, _command: ControlCommandIdentifier, _input: &AnyByLayout, _output: &mut AnyByLayout, ) -> Poll<Result<()>>

Source

fn read_until( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Poll<Result<usize>>

Source

fn write_pattern( &self, context: &mut Context, cx: &mut TaskContext<'_>, pattern: &[u8], count: usize, absolute_position: Size, ) -> Poll<Result<usize>>

Source

fn write_vectored( &self, context: &mut Context, cx: &mut TaskContext<'_>, buffers: &[&[u8]], absolute_position: Size, ) -> Poll<Result<usize>>

Source

fn read_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: Size, ) -> Result<usize>

Source

fn write_sync( &self, context: &mut Context, buffer: &[u8], absolute_position: Size, ) -> Result<usize>

Source

fn flush_sync(&self, context: &mut Context) -> Result<()>

Source

fn control_sync( &self, context: &mut Context, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<()>

Source

fn read_until_sync( &self, context: &mut Context, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Result<usize>

Source

fn write_pattern_sync( &self, context: &mut Context, pattern: &[u8], count: usize, absolute_position: Size, ) -> Result<usize>

Source

fn write_vectored_sync( &self, context: &mut Context, buffers: &[&[u8]], absolute_position: Size, ) -> Result<usize>

Source

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.

Source

fn open(&self, _context: &mut Context) -> Result<()>

Source

fn close(&self, _context: &mut Context) -> Result<()>

Source

fn set_position( &self, _context: &mut Context, current: Size, position: &Position, ) -> Result<Size>

Implementors§