Skip to main content

dope_sys/probe/session/
mod.rs

1use crate::{memory, probe::Stopped};
2mod checked;
3mod closed;
4mod create;
5mod direct;
6mod empty;
7mod occupied;
8mod pending;
9mod primary;
10pub use checked::Checked;
11pub use closed::Closed;
12pub use create::Create;
13pub use direct::Direct;
14pub use empty::Empty;
15pub use occupied::Occupied;
16pub use pending::Pending;
17pub use primary::Primary;
18
19use crate::{io::Close, probe, ring::map::Unmap};
20
21type Failure<S> = probe::Cause<
22    <S as Session>::Probe,
23    <<S as Session>::Outcome as probe::Outcome>::Observation,
24    <S as Session>::Error,
25>;
26type Stage<S> = probe::State<S, <S as Session>::Pending>;
27
28/// An idle capability session owns its canary mappings and fixed-file state.
29pub trait Session: Close<State: Unmap> + Sized {
30    type Ring;
31    type Layout: memory::raw::Canary;
32    type Owned;
33    type Probe: Copy;
34    type Outcome: probe::Outcome<Probe = Self::Probe>;
35    type Error;
36    type Pending: Pending<Session = Self>;
37
38    fn submit(
39        self,
40        entry: &Self::Owned,
41        probe: Self::Probe,
42    ) -> Result<Self::Pending, Stopped<Self, Failure<Self>>>;
43}