o3 0.62.0

shared-nothing primitives
Documentation
use crate::depot::{array::Index, queue::group};

/// N slots admitted before any value is accepted.
pub struct Batch<'a, V, const LANES: usize, const N: usize> {
    pub(super) ledger: &'a mut group::Ledger<V, LANES>,
}

impl<'a, V, const LANES: usize, const N: usize> Batch<'a, V, LANES, N> {
    pub fn new(ledger: &'a mut group::Ledger<V, LANES>) -> Result<Self, group::Error<LANES>> {
        group::Slots::<_, LANES, N>::new(&mut ledger.entries).map_err(group::Error::Entries)?;
        Ok(Self { ledger })
    }

    /// Resolves every owner before accepting any value.
    pub fn bind(
        self,
        owners: [(Index<LANES>, u64); N],
    ) -> Result<group::raw::Entry<'a, V, LANES, N>, group::Error<LANES>> {
        group::raw::Entry::new(self, owners)
    }
}