35 lines
692 B
Rust
35 lines
692 B
Rust
use std::{
|
|
pin::Pin,
|
|
task::{Context, Poll},
|
|
};
|
|
|
|
use io_uring::opcode::Nop;
|
|
|
|
use crate::ring_op::RingOp;
|
|
|
|
pub fn no_op() -> NoOp {
|
|
Default::default()
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct NoOp {
|
|
ring_op: RingOp,
|
|
}
|
|
|
|
impl Future for NoOp {
|
|
type Output = ();
|
|
|
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
|
match self
|
|
.ring_op
|
|
.submit_and_poll(cx, |user_data| Nop::new().build().user_data(user_data))
|
|
{
|
|
Poll::Ready(complete) => {
|
|
debug_assert_eq!(complete.result, 0);
|
|
Poll::Ready(())
|
|
}
|
|
Poll::Pending => Poll::Pending,
|
|
}
|
|
}
|
|
}
|