Trait compio_driver::OpCode

source ·
pub trait OpCode {
    // Required methods
    unsafe fn operate(
        self: Pin<&mut Self>,
        optr: *mut OVERLAPPED
    ) -> Poll<Result<usize>>;
    unsafe fn cancel(self: Pin<&mut Self>, optr: *mut OVERLAPPED) -> Result<()>;
}
Expand description

Abstraction of IOCP operations.

Required Methods§

source

unsafe fn operate( self: Pin<&mut Self>, optr: *mut OVERLAPPED ) -> Poll<Result<usize>>

Perform Windows API call with given pointer to overlapped struct.

It is always safe to cast optr to a pointer to Overlapped<Self>.

Safety
  • self must be alive until the operation completes.
  • Should not use Overlapped::op.
source

unsafe fn cancel(self: Pin<&mut Self>, optr: *mut OVERLAPPED) -> Result<()>

Cancel the async IO operation.

Usually it calls CancelIoEx.

Safety

Implementors§