Trait OpCode
pub unsafe trait OpCode {
type Control: Default;
// Required methods
fn pre_submit(&mut self, _: &mut Self::Control) -> Result<Decision, Error>;
fn operate(&mut self, _: &mut Self::Control) -> Poll<Result<usize, Error>>;
// 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, Error>,
_: &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§
Required Methods§
Provided Methods§
unsafe fn init(&mut self, _: &mut Self::Control)
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.