dope-core 0.77.0

Owned native I/O and completion driver for dope
Documentation
//! Ownership and lifetime contracts.

use o3::base::marker::ThreadBound;
use std::{convert::Infallible, marker};

pub mod client;
pub mod control;
pub mod driver;
pub mod executor;
pub mod io;
pub mod platform;
pub mod signal;
pub mod topology;

pub use dope_sys::{self, Errno};
use dope_sys::{
    engine::{Removal, Source, Storage, admit},
    table::permit,
};
use driver::{
    life::native::{Context, Receive, host::Host},
    receive,
    result::{IoOperation, Kernel, poll},
    schedule::ready::Stored,
    storage::Failure,
};
pub use o3;

type LocalMarker<T> = marker::PhantomData<(fn(T) -> T, ThreadBound)>;
type Engine = <Backend as Source<Host<Backend>>>::Backend;
type Resources = <Backend as Storage<Context, Receive, Failure, (IoOperation, Kernel)>>::Cleanup;
type Released = <Backend as Storage<Context, Receive, Failure, (IoOperation, Kernel)>>::Release;
type RemoveSlot = <Backend as Removal>::Slot;
type ReleasePrimary = ((IoOperation, Kernel), RemoveSlot);
type Permits = <Backend as permit::Source>::Queue<Stored, receive::Index>;
use dope_sys::table::token::host;
use driver::retained::flight::{Arena, Echo};

type CancelRejection = <Backend as admit::Native>::Error<(Echo, admit::Cause<poll::Cause>)>;
type Fault = <Arena as host::raw::Drain>::Fault;
type Reported = <Arena as host::raw::Drain>::Reported;

/// Failure from the first or second branch of a statically composed operation.
#[derive(Debug)]
pub enum BranchError<A, B> {
    /// The first branch failed.
    First(A),
    /// The second branch failed.
    Second(B),
}

impl<A, B> From<Infallible> for BranchError<A, B> {
    fn from(value: Infallible) -> Self {
        match value {}
    }
}

cfg_select! {
    target_os = "linux" => {
        pub use dope_uring::Backend;
    }
    target_os = "macos" => {
        pub use dope_kqueue::Backend;
    }
}