dope-core 0.76.0

Owned native I/O and completion driver for dope
Documentation
use std::{marker, ptr};

use crate::driver::retained::flight::storage::{self, Flights, Preparation};

/// Fully staged flight acquisition retaining its exact arena and preparation loan.
#[must_use = "prepared flight groups must be committed"]
pub struct Prepared<
    'a,
    'owner,
    T: Copy,
    const INDEX_BITS: u32 = 32,
    const GENERATION_BITS: u32 = 32,
    const GROUPS: usize = 1,
    B = (),
> {
    pub(super) arena: &'owner Flights<T, INDEX_BITS, GENERATION_BITS>,
    pub(super) preparation: marker::PhantomData<(&'a mut (), B)>,
    pub(super) states: [Preparation<'owner, T, INDEX_BITS, GENERATION_BITS>; GROUPS],
    pub(super) directory:
        Option<Vec<ptr::NonNull<storage::raw::Entry<T, INDEX_BITS, GENERATION_BITS>>>>,
}

impl<'owner, T: Copy, const INDEX_BITS: u32, const GENERATION_BITS: u32, const GROUPS: usize, B>
    Prepared<'_, 'owner, T, INDEX_BITS, GENERATION_BITS, GROUPS, B>
{
    /// Publishes into the arena used to prepare this batch, without allocation.
    pub fn groups(self) -> [storage::raw::Slots<'owner, T, INDEX_BITS, GENERATION_BITS>; GROUPS] {
        storage::raw::Pool::commit(self)
    }
}