jay-compositor 1.15.0

The Jay compositor
use crate::io_uring::IoUringError;
use jay_algorithms::oserror::OsError;

pub mod accept;
pub mod async_cancel;
pub mod connect;
pub mod futex;
pub mod poll;
pub mod poll_external;
pub mod read_multishot;
pub mod read_write;
pub mod read_write_no_cancel;
pub mod read_write_vec;
pub mod recvmsg;
pub mod sendmsg;
pub mod timeout;
pub mod timeout_external;
pub mod timeout_link;
pub mod writev_external;

pub type TaskResult<T> = Result<Result<T, OsError>, IoUringError>;

pub trait TaskResultExt<T> {
    fn merge(self) -> Result<T, IoUringError>;
}

impl<T> TaskResultExt<T> for TaskResult<T> {
    fn merge(self) -> Result<T, IoUringError> {
        match self {
            Ok(Ok(t)) => Ok(t),
            Ok(Err(e)) => Err(IoUringError::OsError(e)),
            Err(e) => Err(e),
        }
    }
}