OpCode

Trait OpCode 

pub trait OpCode {
    // Required method
    unsafe fn operate(
        self: Pin<&mut Self>,
        optr: *mut OVERLAPPED,
    ) -> Poll<Result<usize, Error>>;

    // Provided methods
    fn op_type(&self) -> OpType { ... }
    fn cancel(self: Pin<&mut Self>, optr: *mut OVERLAPPED) -> Result<(), Error> { ... }
}
Expand description

Abstraction of IOCP operations.

Required Methods§

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

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§

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.

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

Cancel the async IO operation.

Usually it calls CancelIoEx.

Implementors§

§

impl OpCode for CloseFile

§

impl OpCode for CloseSocket

§

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

§

impl<S> OpCode for Accept<S>
where S: AsFd,

§

impl<S> OpCode for Connect<S>
where S: AsFd,

§

impl<S> OpCode for ConnectNamedPipe<S>
where S: AsFd,

§

impl<S> OpCode for ReadManaged<S>
where S: AsFd,

§

impl<S> OpCode for ReadManagedAt<S>
where S: AsFd,

§

impl<S> OpCode for RecvManaged<S>
where S: AsFd,

§

impl<S> OpCode for ShutdownSocket<S>
where S: AsFd,

§

impl<S> OpCode for Sync<S>
where S: AsFd,

§

impl<S, D, F> OpCode for AsyncifyFd<S, F, D>
where D: Send + 'static, F: FnOnce(&S) -> BufResult<usize, D> + Send + 'static,

§

impl<S, I, O> OpCode for DeviceIoControl<S, I, O>
where S: AsFd, I: IoBuf, O: IoBufMut,

§

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

§

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

§

impl<T, S> OpCode for Read<T, S>
where T: IoBufMut, S: AsFd,

§

impl<T, S> OpCode for ReadAt<T, S>
where T: IoBufMut, S: AsFd,

§

impl<T, S> OpCode for Recv<T, S>
where T: IoBufMut, S: AsFd,

§

impl<T, S> OpCode for RecvFrom<T, S>
where T: IoBufMut, S: AsFd,

§

impl<T, S> OpCode for RecvFromVectored<T, S>
where T: IoVectoredBufMut, S: AsFd,

§

impl<T, S> OpCode for RecvVectored<T, S>
where T: IoVectoredBufMut, S: AsFd,

§

impl<T, S> OpCode for Send<T, S>
where T: IoBuf, S: AsFd,

§

impl<T, S> OpCode for SendTo<T, S>
where T: IoBuf, S: AsFd,

§

impl<T, S> OpCode for SendToVectored<T, S>
where T: IoVectoredBuf, S: AsFd,

§

impl<T, S> OpCode for SendVectored<T, S>
where T: IoVectoredBuf, S: AsFd,

§

impl<T, S> OpCode for Write<T, S>
where T: IoBuf, S: AsFd,

§

impl<T, S> OpCode for WriteAt<T, S>
where T: IoBuf, S: AsFd,