Skip to main content

dope_core/
lib.rs

1//! Ownership and lifetime contracts.
2
3use std::convert::Infallible;
4
5pub mod client;
6pub mod control;
7pub mod driver;
8pub mod executor;
9pub mod io;
10pub mod platform;
11pub mod signal;
12pub mod topology;
13
14pub use dope_sys::{self, Errno};
15use dope_sys::{
16    engine::{Removal, Source, Storage},
17    table::permit,
18};
19use driver::{
20    life::native::{Context, Receive, host::Host},
21    receive,
22    result::{IoOperation, Kernel},
23    schedule::ready::Stored,
24    storage::Failure,
25};
26pub use o3;
27
28type Engine = <Backend as Source<Host<Backend>>>::Backend;
29type Resources = <Backend as Storage<Context, Receive, Failure, (IoOperation, Kernel)>>::Cleanup;
30type Released = <Backend as Storage<Context, Receive, Failure, (IoOperation, Kernel)>>::Release;
31type RemoveSlot = <Backend as Removal>::Slot;
32type Permits = <Backend as permit::Source>::Queue<Stored, receive::Index>;
33use dope_sys::table::token::host;
34use driver::retained::flight::Arena;
35
36type Fault = <Arena as host::raw::Drain>::Fault;
37type Reported = <Arena as host::raw::Drain>::Reported;
38
39/// Failure from the first or second branch of a statically composed operation.
40#[derive(Debug)]
41pub enum BranchError<A, B> {
42    /// The first branch failed.
43    First(A),
44    /// The second branch failed.
45    Second(B),
46}
47
48impl<A, B> From<Infallible> for BranchError<A, B> {
49    fn from(value: Infallible) -> Self {
50        match value {}
51    }
52}
53
54cfg_select! {
55    target_os = "linux" => {
56        pub use dope_uring::Backend;
57    }
58    target_os = "macos" => {
59        pub use dope_kqueue::Backend;
60    }
61}