dope_sys/ring/create/
mod.rs1mod acquire;
2mod build;
3mod cause;
4mod error;
5mod failure;
6mod primary;
7mod retain;
8pub use acquire::Acquire;
9pub use build::Build;
10pub use cause::Cause;
11pub use error::Error;
12pub use failure::Failure;
13use o3::base::num::bounded;
14pub use primary::Primary;
15pub use retain::Retain;
16
17use crate::{
18 io::{Close, reactor::complete},
19 memory,
20 memory::buffer::provided,
21 probe, ring,
22 ring::{map, ready},
23 table::token,
24};
25
26type Creation<S> = Error<<S as Create>::Setup, <S as Create>::Map, <S as Create>::Cleanup>;
27
28pub trait Source: probe::Source + provided::Source {
30 type Primary: Copy;
31 type Failure<T: token::Codec>
32 where
33 Self: complete::Observe<T>;
34 type Resources<T: token::Codec, L: memory::raw::Canary, P: Copy + From<Self::Primary> + From<memory::Error>>: Retain<
35 P,
36 Error = <Self as Source>::Failure<T>,
37 Ring = Self::Ring<T>,
38 Probe = <Self as probe::Source>::Cleanup<T, L, P>,
39 Canary = Self::Canary<L>,
40 Context = Self::Context<L>,
41 Producer = Self::Producer<L>,
42 Registration = <Self::Ring<T> as ring::Owner>::Registration,
43 Registered = <Self::Ring<T> as ring::Owner>::Registered,
44 BufferError = <Self::Ready<T, L> as ready::Ready>::BufferError,
45 >
46 where
47 Self: complete::Observe<T>;
48}
49
50pub trait Create: Close + Sized {
52 type Setup: Copy;
53 type Map: Copy;
54 type Unmap;
55 type Cleanup: memory::Cleanup<Cause<Self::Setup, Self::Map>, Error = map::Failure<Self::Unmap>>;
56
57 fn new<const MIN: u32, const MAX: u32, const CQ: u32>(
58 submit: bounded::raw::U32<MIN, MAX>,
59 complete: bounded::raw::U32<1, CQ>,
60 defer: bool,
61 ) -> Result<Self, Creation<Self>>;
62}