dope-sys 0.76.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
/// Quiescence requires every pinned chain to have released its target.
/// `into_storage` must keep all kernel-reachable addresses valid and stationary
/// until the returned owner is dropped, including during a failed shutdown.
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];
}