dope-sys 0.78.0

Typed operating-system call contracts
Documentation
use crate::{Errno, io::reactor::event::kind::Native, table};
use o3::buffer::storage::provided;

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[repr(transparent)]
pub struct Echo<K>(K);

impl<K> Echo<K> {
    pub const fn new(echo: K) -> Self {
        Self(echo)
    }
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[repr(u8)]
pub enum Raw<S> {
    BufferIndex(S),
    Flags,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Subject<T, C, E, I> {
    Unbound,
    Target(T),
    Control(C),
    CancelFlight(E),
    CancelTuning(I),
    Tuning { echo: E, control: C },
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[repr(u8)]
pub enum Violation<S, E, L, N, O, I, B, C, R> {
    Raw(Raw<S>),
    Stale(E),
    UserData,
    Control,
    Buffer,
    Provided(provided::raw::Full),
    BufferLength {
        actual: L,
        capacity: N,
    },
    Result,
    Outcome(O),
    Slot,
    SlotIndex(B),
    Install(table::Install<I>),
    Descriptor((I, C)),
    Operation {
        expected: Native,
        observed: Native,
    },
    Tuning(Native),
    Close,
    Class {
        expected: R,
        observed: R,
    },
    RawClass {
        cause: Raw<S>,
        expected: R,
        observed: R,
    },
    Cleanup(Errno),
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[repr(C)]
pub struct Fault<O, S, V> {
    pub observation: O,
    pub subject: S,
    pub violation: V,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct Dispatch<F> {
    pub drain: crate::engine::Drain,
    pub fault: F,
}

impl<F> Dispatch<F> {
    pub const fn new(drain: crate::engine::Drain, fault: F) -> Self {
        Self { drain, fault }
    }
}