dope-sys 0.78.0

Typed operating-system call contracts
Documentation
mod chain;

use std::{num, pin};

pub use chain::Chain;

use crate::io::socket::option::tuning::Occupied;

/// # Safety
/// Quiescent chains hold no targets. After `into_storage`, even a failed shutdown
/// keeps kernel-reachable addresses valid and stationary until the returned owner drops.
pub unsafe trait Quiesce {
    type Storage;

    fn is_quiescent(&self) -> bool;
    fn into_storage(self) -> Self::Storage;
}

/// # Safety
/// Pinned values retain their addresses until the exact chain terminates.
pub unsafe trait State<E: Copy, const N: usize>: Default {
    type Occupied<'a>: Occupied<E>
    where
        Self: 'a;

    fn bind(self: pin::Pin<&mut Self>) -> Option<Self::Occupied<'_>>;

    /// # Safety
    /// No prior chain is live; `count` equals the option CQE count and is at most N.
    /// Keep this owner pinned and all values live through every CQE or quiescence.
    unsafe fn values(
        self: pin::Pin<&mut Self>,
        target: E,
        count: num::NonZero<u32>,
    ) -> &mut [libc::c_int; N];
}