orengine 0.7.0-alpha.1

Optimized ring engine for Rust. It is a lighter and faster asynchronous library than tokio-rs, async-std, may, and even smol.
Documentation
use crate as orengine;
use crate::io::io_request_data::IoRequestData;
use crate::io::sys::OsPath::OsPath;
use crate::io::worker::{local_worker, IoWorker};
use orengine_macros::poll_for_io_request;
use std::future::Future;
use std::io::Result;
use std::pin::Pin;
use std::task::{Context, Poll};

/// Create a directory at the given path.
pub struct CreateDir {
    mode: u32,
    os_path: OsPath,
    io_request_data: Option<IoRequestData>,
}

impl CreateDir {
    /// Creates a new `CreateDir` future for the given path.
    pub fn new(path: OsPath, mode: u32) -> Self {
        Self {
            mode,
            os_path: path,
            io_request_data: None,
        }
    }
}

unsafe impl Send for CreateDir {}

impl Future for CreateDir {
    type Output = Result<()>;

    fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
        let this = unsafe { self.get_unchecked_mut() };
        #[allow(unused, reason = "Cannot write proc_macro else to make it readable.")]
        let ret;

        poll_for_io_request!((
            local_worker().create_dir(this.os_path.as_ptr(), this.mode, unsafe {
                this.io_request_data.as_mut().unwrap_unchecked()
            }),
            ()
        ));
    }
}