dope-core 0.77.0

Owned native I/O and completion driver for dope
Documentation
use std::mem;

use crate::driver::schedule::clock::timer::heap;

/// Exact capability proving that an armed minimum exists.
pub struct Minimum<'a, P: Ord, R> {
    pub(super) core: &'a mut heap::raw::Core<P, R>,
    pub(super) root: heap::raw::Root,
}

impl<'a, P: Ord, R> Minimum<'a, P, R> {
    pub fn priority(&self) -> &P {
        self.core.priority_at(self.root.position())
    }

    /// Removes the minimum, marks its slot fired, and borrows its live resident.
    pub fn fire(self) -> &'a R {
        self.core.fire(self.root)
    }
}

const _: () = {
    assert!(mem::size_of::<Minimum<'_, u8, u8>>() == mem::size_of::<usize>());
    assert!(mem::align_of::<Minimum<'_, u8, u8>>() == mem::align_of::<usize>());
    assert!(mem::size_of::<Option<Minimum<'_, u8, u8>>>() == mem::size_of::<usize>());
};