dope_core/driver/result/poll/
mod.rs1use std::{mem, os::fd, task};
2
3pub use dope_sys::table::change::Filter;
5
6use crate::driver::route::{indices, table::bounds};
7
8mod cause;
9mod dispatch;
10mod error;
11pub mod fault;
12
13pub use cause::Cause;
14pub use dispatch::{Dispatch, Failure};
15pub use error::Error;
16
17#[derive(Clone, Copy, Eq, PartialEq, Debug)]
19pub enum Operation {
20 Wait,
21 Changes,
22 Accept,
23 Connect,
24 SocketError,
25 Recv,
26 RecvMsg,
27 Send,
28 Shutdown,
29 FileOpen,
30 FileWrite,
31 FileSync,
32 FileRename,
33 FileUnlink,
34}
35
36#[derive(Clone, Copy, Eq, PartialEq, Debug)]
38#[repr(u8)]
39pub enum Missing {
40 Bounds(bounds::Excluded),
41 Backing {
42 index: indices::SlotIndex,
43 },
44 Vacant {
45 index: indices::SlotIndex,
46 },
47 Replaced {
48 index: indices::SlotIndex,
49 expected: fd::RawFd,
50 actual: fd::RawFd,
51 },
52}
53
54#[derive(Clone, Copy, Eq, PartialEq, Debug)]
55#[must_use = "pending backend events must be drained before blocking"]
56pub enum Drain {
57 Drained,
59 Pending,
61}
62
63impl From<task::Poll<()>> for Drain {
64 fn from(state: task::Poll<()>) -> Self {
65 match state {
66 task::Poll::Ready(()) => Self::Drained,
67 task::Poll::Pending => Self::Pending,
68 }
69 }
70}
71
72#[derive(Clone, Copy, Eq, PartialEq)]
74#[must_use = "pending backend changes must be committed in a later reactor turn"]
75pub enum Commit {
76 Drained,
78 Pending,
80}
81
82const _: () = {
83 assert!(mem::size_of::<Missing>() == 4 * mem::size_of::<u32>());
84 assert!(mem::align_of::<Missing>() == mem::align_of::<u32>());
85 assert!(mem::size_of::<Operation>() == 1);
86 assert!(core::mem::size_of::<Result<(), Error>>() == core::mem::size_of::<Error>());
87 assert!(core::mem::size_of::<Result<Commit, Error>>() == core::mem::size_of::<Error>());
88};
89
90#[derive(Clone, Copy, Debug, Eq, PartialEq)]
92pub enum Close {
93 Missing(Missing),
94 Closed(Result<(), crate::Errno>),
95}