Skip to main content

dope_core/
lib.rs

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