pub trait OpCode {
// Required method
unsafe fn operate(
self: Pin<&mut Self>,
optr: *mut OVERLAPPED,
) -> Poll<Result<usize>>;
// Provided methods
fn op_type(&self) -> OpType { ... }
unsafe fn cancel(self: Pin<&mut Self>, optr: *mut OVERLAPPED) -> Result<()> { ... }
}
Expand description
Abstraction of IOCP operations.
Required Methods§
Sourceunsafe fn operate(
self: Pin<&mut Self>,
optr: *mut OVERLAPPED,
) -> Poll<Result<usize>>
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>
.
Don’t do heavy work here if OpCode::op_type
returns
OpType::Event
.
§Safety
self
must be alive until the operation completes.- When
OpCode::op_type
returnsOpType::Blocking
, this method is called in another thread.