use crate::{
Errno,
driver::{route, route::kind},
io::event::entry::Entry,
};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Error {
Option(Errno),
Connect(Errno),
}
#[repr(transparent)]
pub struct Completion<'d>(Entry<'d, kind::Connect, Result<(), Error>>);
impl<'d> Completion<'d> {
pub(in crate::io) const fn new(
target: route::Erased<'d, kind::Connect>,
outcome: Result<(), Error>,
) -> Self {
Self(Entry::new(target, outcome))
}
pub const fn token(&self) -> route::Erased<'d, kind::Connect> {
self.0.token()
}
pub(in crate::io) fn resolve(
self,
expected: route::Erased<'d, kind::Connect>,
) -> Result<Result<(), Error>, Self> {
self.0.resolve(expected).map_err(Self)
}
}