use std::mem;
use dope_sys::{io::reactor::complete, ring::Source, table::token};
use dope_uring::Backend;
use crate::common::cleanup;
type Entry = <Backend as Source>::Entry<()>;
type Outcome = <Entry as complete::Entry>::Outcome;
type Returned = <Outcome as complete::Outcome>::Returned;
type Token = <Backend as token::Source>::Token<cleanup::Host>;
pub trait Word {
type Native;
fn native(self) -> Self::Native;
}
impl Word for i32 {
type Native = Outcome;
fn native(self) -> Outcome {
unsafe { mem::transmute(self) }
}
}
impl Word for u64 {
type Native = Token;
fn native(self) -> Token {
unsafe { mem::transmute(self) }
}
}
pub trait Rejected {
fn word(self) -> i32;
}
impl Rejected for Returned {
fn word(self) -> i32 {
unsafe { mem::transmute(self) }
}
}