use crate::depot::{array::Index, queue::group};
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 })
}
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)
}
}