use std::time;
use crate::{
Errno,
table::change::{Filter, Index},
};
mod backend;
pub mod delivery;
mod driver;
mod poll;
pub mod raw;
mod source;
pub mod store;
pub use backend::Backend;
pub use driver::Driver;
pub use poll::Poll;
pub use source::Source;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Cause {
Timeout(time::Duration),
Wait(Errno),
Changes(Errno),
}
pub const RECEIPTS: usize = 64;
#[derive(Debug)]
pub struct Failures<F> {
pub first: F,
pub rest: [Option<F>; RECEIPTS - 1],
}
impl<F> From<F> for Failures<F> {
fn from(first: F) -> Self {
Self {
first,
rest: [const { None }; RECEIPTS - 1],
}
}
}
pub trait Failure: Copy + From<Cause> {
type Index: Copy + Eq;
type Missing: Copy + Eq;
type Operation: Copy;
fn revoke(fd: usize, filter: Filter, errno: Errno) -> Self;
fn backing(error: Index<Self::Index>) -> Self;
fn missing(op: Self::Operation, cause: Self::Missing) -> Self;
fn system(op: Self::Operation, errno: Errno) -> Self;
}