use crate::depot::queue::{
indexed::{lanes, lanes::runtime},
links, tagged,
};
unsafe impl<T, const N: usize, C: crate::depot::raw::Count> crate::depot::raw::TagStore
for lanes::Fifo<T, N, C>
{
type Head = links::Chain;
type Heads = [links::Chain; N];
fn heads(&self) -> &Self::Heads {
self.nodes.state()
}
unsafe fn hook(&self, index: links::Index) -> &tagged::Hook {
&unsafe { self.nodes().get_unchecked(index.get()) }.hook
}
}
unsafe impl<T, const N: usize, C: crate::depot::raw::Count> crate::depot::raw::LaneStore
for lanes::Fifo<T, N, C>
{
type Item = T;
fn nodes(&self) -> &[lanes::Value<T>] {
&self.nodes
}
}
unsafe impl<T, C: crate::depot::raw::Count, L: crate::depot::raw::Count, H: tagged::raw::Head>
crate::depot::raw::TagStore for runtime::Fifo<T, C, L, H>
{
type Head = H;
type Heads = [H];
fn heads(&self) -> &Self::Heads {
self.block.tail()
}
fn is_node(&self, word: u32) -> bool {
(word as usize) < self.block.extent().shape().capacity().count().get()
}
unsafe fn hook(&self, index: links::Index) -> &tagged::Hook {
&unsafe { self.nodes().get_unchecked(index.get()) }.hook
}
}
unsafe impl<T, C: crate::depot::raw::Count, L: crate::depot::raw::Count, H: tagged::raw::Head>
crate::depot::raw::LaneStore for runtime::Fifo<T, C, L, H>
{
type Item = T;
fn nodes(&self) -> &[lanes::Value<T>] {
self.block.as_ref()
}
}
unsafe impl<'a, T, C: crate::depot::raw::Count, L: crate::depot::raw::Count, H: tagged::raw::Head>
crate::depot::raw::Project<links::Index, links::Chain> for &'a runtime::Fifo<T, C, L, H>
{
type Output = &'a T;
unsafe fn project(self, index: links::Index) -> Self::Output {
unsafe { (*self.nodes().get_unchecked(index.get()).value.get()).assume_init_ref() }
}
}
mod store;
mod undo;
pub(in crate::depot) use store::LaneStore;
pub(in crate::depot) use undo::LaneUndo;