Skip to main content

dope_sys/ring/ready/
raw.rs

1use crate::{
2    memory::buffer::provided,
3    ring::ready::{Error, Ready},
4};
5
6type Failure<R> = Error<
7    <R as Ready>::Ring,
8    <R as Ready>::Producer,
9    <<R as Ready>::Producer as provided::Producer>::Error,
10    <R as Ready>::Registration,
11    <R as Ready>::Registered,
12    <R as Ready>::BufferError,
13>;
14
15pub trait Create: Ready {
16    /// # Safety
17    /// Keep this exact Context live until the reactor and every returned owner close.
18    unsafe fn new(ring: Self::Ring, context: &Self::Context) -> Result<Self, Failure<Self>>;
19}
20
21/// Constructs and registers receive storage, retaining every failed resource.
22pub trait Bind<P>: Ready {
23    type Cleanup: crate::memory::Cleanup<P>;
24
25    /// # Safety
26    /// Keep the returned Context beside this reactor until native quiescence and
27    /// destruction. Every failed registration retains its own exact Context.
28    unsafe fn bind(
29        ring: Self::Ring,
30        layout: Self::Layout,
31    ) -> Result<(Self, Self::Context), Result<P, Self::Cleanup>>;
32}