dope-core 0.75.0

Owned native I/O and completion driver for dope
Documentation
use crate::{
    driver::{
        retained::{flight, flight::cancel::Error},
        route,
        route::kind::Socket,
        schedule::ready,
    },
    io::fd::lease,
};

/// An outbound descriptor slot whose socket creation is in flight.
///
/// Its invariant driver lifetime cannot be shortened into another scope.
///
#[repr(C)]
pub struct Creation<'d> {
    pub(super) lease: lease::Lease<'d, lease::Creating>,
    pub(super) flight: flight::Flight<'d, Socket>,
}

impl<'d> Creation<'d> {
    pub fn try_cancel(&mut self, driver: &mut crate::driver::Local<'d>) -> Result<(), Error> {
        self.flight.try_cancel(driver).map(|_| ())
    }

    pub fn matches(&self, token: route::Erased<'d, Socket>) -> bool {
        self.flight.matches(token)
    }

    pub fn ready_handle(&self) -> ready::Handle<'d> {
        self.lease.ready_handle()
    }
}