Skip to main content

PollOpCode

Trait PollOpCode 

Source
pub unsafe trait PollOpCode {
    type Control: Default;

    // Required methods
    fn pre_submit(&mut self, _: &mut Self::Control) -> Result<Decision>;
    fn operate(&mut self, _: &mut Self::Control) -> Poll<Result<usize>>;

    // Provided methods
    unsafe fn init(&mut self, _: &mut Self::Control) { ... }
    fn op_type(&mut self, _: &mut Self::Control) -> Option<OpType> { ... }
    unsafe fn set_result(
        &mut self,
        _: &mut Self::Control,
        _: &Result<usize>,
        _: &Extra,
    ) { ... }
}
Expand description

Abstraction of operations.

§Safety

If pre_submit returns Decision::Wait, op_type must also return Some(OpType::Fd) with same fds as the WaitArgs. Similarly, if pre_submit returns Decision::Aio, op_type must return Some(OpType::Aio) with the correct aiocb pointer.

Required Associated Types§

Source

type Control: Default

Type that contains self-references and other needed info during the operation

Required Methods§

Source

fn pre_submit(&mut self, _: &mut Self::Control) -> Result<Decision>

Perform the operation before submit, and return Decision to indicate whether submitting the operation to polling is required.

Source

fn operate(&mut self, _: &mut Self::Control) -> Poll<Result<usize>>

Perform the operation after received corresponding event. If this operation is blocking, the return value should be Poll::Ready.

Provided Methods§

Source

unsafe fn init(&mut self, _: &mut Self::Control)

Initialize the control

§Safety

Caller must guarantee that during the lifetime of ctrl, Self is unmoved and valid.

Source

fn op_type(&mut self, _: &mut Self::Control) -> Option<OpType>

Get the operation type when an event is occurred.

Source

unsafe fn set_result( &mut self, _: &mut Self::Control, _: &Result<usize>, _: &Extra, )

Set the result when it completes. The operation stores the result and is responsible to release it if the operation is cancelled.

§Safety

The params must be the result coming from this operation.

Implementors§

Source§

impl OpCode for CloseFile

Source§

impl OpCode for CloseSocket

Source§

impl OpCode for CreateSocket

Source§

impl OpCode for Pipe

Source§

impl<C: IoBufMut, S: AsFd> OpCode for RecvMsgManaged<C, S>

Source§

type Control = <RecvMsgManaged<C, S> as OpCode>::Control

Source§

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

Available on polling only.
Source§

impl<S1, S2, D, F> OpCode for AsyncifyFd2<S1, S2, F, D>
where S1: Sync, S2: Sync, D: Send + 'static, F: FnOnce(&S1, &S2) -> BufResult<usize, D> + Send + 'static,

Available on polling only.
Source§

impl<S1: AsFd, S2: AsFd> OpCode for HardLink<S1, S2>

Source§

impl<S1: AsFd, S2: AsFd> OpCode for Rename<S1, S2>

Source§

impl<S1: AsFd, S2: AsFd> OpCode for Splice<S1, S2>

Available on linux_all only.
Source§

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

Available on polling only.
Source§

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

Source§

impl<S: AsFd> OpCode for AcceptMulti<S>

Source§

type Control = <AcceptMulti<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for Bind<S>

Source§

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

Source§

impl<S: AsFd> OpCode for CreateDir<S>

Source§

impl<S: AsFd> OpCode for FileStat<S>

Source§

type Control = <FileStat<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for Listen<S>

Source§

impl<S: AsFd> OpCode for OpenFile<S>

Source§

impl<S: AsFd> OpCode for PathStat<S>

Source§

type Control = <PathStat<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for PollOnce<S>

Source§

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

Source§

type Control = <ReadManaged<S> as OpCode>::Control

Source§

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

Source§

type Control = <ReadManagedAt<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for ReadMulti<S>

Source§

type Control = <ReadManaged<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for ReadMultiAt<S>

Source§

type Control = <ReadManagedAt<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for RecvFromManaged<S>

Source§

type Control = <RecvFromManaged<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for RecvFromMulti<S>

Source§

type Control = <RecvFromMulti<S> as OpCode>::Control

Source§

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

Source§

type Control = <RecvManaged<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for RecvMsgMulti<S>

Source§

type Control = <RecvMsgMulti<S> as OpCode>::Control

Source§

impl<S: AsFd> OpCode for RecvMulti<S>

Source§

type Control = <RecvManaged<S> as OpCode>::Control

Source§

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

Source§

impl<S: AsFd> OpCode for Symlink<S>

Source§

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

Source§

type Control = AioControl

Source§

impl<S: AsFd> OpCode for TruncateFile<S>

Source§

impl<S: AsFd> OpCode for Unlink<S>

Source§

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

Source§

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

Source§

impl<T: IoBuf, S: AsFd> OpCode for SendToZc<T, S>

Source§

impl<T: IoBuf, S: AsFd> OpCode for SendZc<T, S>

Source§

type Control = <Send<T, S> as OpCode>::Control

Source§

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

Source§

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

Source§

type Control = AioControl

Source§

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

Source§

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

Source§

type Control = AioControl

Source§

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

Source§

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

Source§

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

Source§

type Control = SendMsgControl

Source§

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

Source§

type Control = <SendMsg<T, C, S> as OpCode>::Control

Source§

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

Source§

type Control = SendMsgControl

Source§

impl<T: IoVectoredBuf, S: AsFd> OpCode for SendToVectoredZc<T, S>

Source§

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

Source§

type Control = SendVectoredControl

Source§

impl<T: IoVectoredBuf, S: AsFd> OpCode for SendVectoredZc<T, S>

Source§

impl<T: IoVectoredBuf, S: AsFd> OpCode for WriteVectored<T, S>

Source§

type Control = VectoredControl

Source§

impl<T: IoVectoredBuf, S: AsFd> OpCode for WriteVectoredAt<T, S>

Source§

type Control = AioControl<VectoredControl>

Source§

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

Source§

type Control = RecvMsgControl

Source§

impl<T: IoVectoredBufMut, S: AsFd> OpCode for ReadVectored<T, S>

Source§

type Control = VectoredControl

Source§

impl<T: IoVectoredBufMut, S: AsFd> OpCode for ReadVectoredAt<T, S>

Source§

type Control = AioControl<VectoredControl>

Source§

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

Source§

type Control = RecvMsgControl

Source§

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

Source§

type Control = RecvVectoredControl