pub trait DirectBaseOperations: Send + Sync {
Show 18 methods
// Required methods
fn read(
&self,
cx: &mut TaskContext<'_>,
buffer: &mut [u8],
absolute_position: Size,
) -> Poll<Result<usize>>;
fn write(
&self,
cx: &mut TaskContext<'_>,
buffer: &[u8],
absolute_position: Size,
) -> Poll<Result<usize>>;
// Provided methods
fn flush(&self, _cx: &mut TaskContext<'_>) -> Poll<Result<()>> { ... }
fn control(
&self,
_cx: &mut TaskContext<'_>,
_command: ControlCommandIdentifier,
_input: &AnyByLayout,
_output: &mut AnyByLayout,
) -> Poll<Result<()>> { ... }
fn read_until(
&self,
cx: &mut TaskContext<'_>,
buffer: &mut [u8],
absolute_position: Size,
delimiter: &[u8],
) -> Poll<Result<usize>> { ... }
fn write_pattern(
&self,
cx: &mut TaskContext<'_>,
pattern: &[u8],
count: usize,
absolute_position: Size,
) -> Poll<Result<usize>> { ... }
fn write_vectored(
&self,
cx: &mut TaskContext<'_>,
buffers: &[&[u8]],
absolute_position: Size,
) -> Poll<Result<usize>> { ... }
fn read_sync(
&self,
buffer: &mut [u8],
absolute_position: Size,
) -> Result<usize> { ... }
fn write_sync(
&self,
buffer: &[u8],
absolute_position: Size,
) -> Result<usize> { ... }
fn flush_sync(&self) -> Result<()> { ... }
fn control_sync(
&self,
command: ControlCommandIdentifier,
input: &AnyByLayout,
output: &mut AnyByLayout,
) -> Result<()> { ... }
fn read_until_sync(
&self,
buffer: &mut [u8],
absolute_position: Size,
delimiter: &[u8],
) -> Result<usize> { ... }
fn write_pattern_sync(
&self,
pattern: &[u8],
count: usize,
absolute_position: Size,
) -> Result<usize> { ... }
fn write_vectored_sync(
&self,
buffers: &[&[u8]],
absolute_position: Size,
) -> Result<usize> { ... }
fn cancel_operation(&self, _operation: Operation) { ... }
fn open(&self) -> Result<()> { ... }
fn close(&self) -> Result<()> { ... }
fn set_position(&self, 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§
fn read( &self, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, ) -> Poll<Result<usize>>
fn write( &self, cx: &mut TaskContext<'_>, buffer: &[u8], absolute_position: Size, ) -> Poll<Result<usize>>
Provided Methods§
fn flush(&self, _cx: &mut TaskContext<'_>) -> Poll<Result<()>>
fn control( &self, _cx: &mut TaskContext<'_>, _command: ControlCommandIdentifier, _input: &AnyByLayout, _output: &mut AnyByLayout, ) -> Poll<Result<()>>
fn read_until( &self, cx: &mut TaskContext<'_>, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Poll<Result<usize>>
fn write_pattern( &self, cx: &mut TaskContext<'_>, pattern: &[u8], count: usize, absolute_position: Size, ) -> Poll<Result<usize>>
fn write_vectored( &self, cx: &mut TaskContext<'_>, buffers: &[&[u8]], absolute_position: Size, ) -> Poll<Result<usize>>
fn read_sync(&self, buffer: &mut [u8], absolute_position: Size) -> Result<usize>
fn write_sync(&self, buffer: &[u8], absolute_position: Size) -> Result<usize>
fn flush_sync(&self) -> Result<()>
fn control_sync( &self, command: ControlCommandIdentifier, input: &AnyByLayout, output: &mut AnyByLayout, ) -> Result<()>
fn read_until_sync( &self, buffer: &mut [u8], absolute_position: Size, delimiter: &[u8], ) -> Result<usize>
fn write_pattern_sync( &self, pattern: &[u8], count: usize, absolute_position: Size, ) -> Result<usize>
fn write_vectored_sync( &self, buffers: &[&[u8]], absolute_position: Size, ) -> Result<usize>
Sourcefn cancel_operation(&self, _operation: Operation)
fn cancel_operation(&self, _operation: Operation)
Detach the current operation’s registration; see BaseOperations.