compio_driver

Trait OpCode

Source
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§

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>.

Don’t do heavy work here if OpCode::op_type returns OpType::Event.

§Safety

Provided Methods§

Source

fn op_type(&self) -> OpType

Determines that the operation is really overlapped defined by Windows API. If not, the driver will try to operate it in another thread.

Source

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

Cancel the async IO operation.

Usually it calls CancelIoEx.

§Safety
  • Should not use [Overlapped::op].

Implementors§

Source§

impl OpCode for CloseFile

Source§

impl OpCode for CloseSocket

Source§

impl<D: Send + 'static, F: FnOnce() -> BufResult<usize, D> + Send + Sync + 'static> OpCode for Asyncify<F, D>

Source§

impl<S: AsRawFd> OpCode for Accept<S>

Source§

impl<S: AsRawFd> OpCode for Connect<S>

Source§

impl<S: AsRawFd> OpCode for ConnectNamedPipe<S>

Source§

impl<S: AsRawFd> OpCode for ShutdownSocket<S>

Source§

impl<S: AsRawFd> OpCode for Sync<S>

Source§

impl<T: IoBuf, S: AsRawFd> OpCode for Send<T, S>

Source§

impl<T: IoBuf, S: AsRawFd> OpCode for SendTo<T, S>

Source§

impl<T: IoBuf, S: AsRawFd> OpCode for WriteAt<T, S>

Source§

impl<T: IoBufMut, S: AsRawFd> OpCode for ReadAt<T, S>

Source§

impl<T: IoBufMut, S: AsRawFd> OpCode for Recv<T, S>

Source§

impl<T: IoBufMut, S: AsRawFd> OpCode for RecvFrom<T, S>

Source§

impl<T: IoVectoredBuf, C: IoBuf, S: AsRawFd> OpCode for SendMsg<T, C, S>

Source§

impl<T: IoVectoredBuf, S: AsRawFd> OpCode for SendToVectored<T, S>

Source§

impl<T: IoVectoredBuf, S: AsRawFd> OpCode for SendVectored<T, S>

Source§

impl<T: IoVectoredBufMut, C: IoBufMut, S: AsRawFd> OpCode for RecvMsg<T, C, S>

Source§

impl<T: IoVectoredBufMut, S: AsRawFd> OpCode for RecvFromVectored<T, S>

Source§

impl<T: IoVectoredBufMut, S: AsRawFd> OpCode for RecvVectored<T, S>