use crate::depot::{
array, capacity,
map::priority,
queue::{
indexed::{exact, fifo},
links,
},
};
unsafe impl<T, const N: usize> crate::depot::raw::Exact for array::IntoIter<T, N> {
type Output = ();
fn remaining(&self) -> capacity::Count {
capacity::Count::new(self.len() as u32)
}
unsafe fn finish(self) {
drop(self);
}
}
unsafe impl<T, const N: usize> crate::depot::raw::Exact for &mut array::IntoIter<T, N> {
type Output = ();
fn remaining(&self) -> capacity::Count {
crate::depot::raw::Exact::remaining(&**self)
}
unsafe fn finish(self) {}
}
unsafe impl<'a, T: Copy + Eq, I: crate::depot::raw::Compact> crate::depot::raw::Project<I>
for &'a mut fifo::List<T, I, exact::Policy>
{
type Output = exact::Entry<'a, T, I>;
unsafe fn project(self, index: I) -> Self::Output {
exact::Entry::from_source(unsafe { crate::depot::raw::Proof::new(((self, ()), index)) }).0
}
}
unsafe impl<'a, K, P: Ord, V, H> crate::depot::raw::Project<links::Index>
for &'a mut priority::Min<K, P, V, H>
{
type Output = priority::Occupied<'a, K, P, V>;
unsafe fn project(self, index: links::Index) -> Self::Output {
priority::Min::entry_at(unsafe { crate::depot::raw::Proof::new((self, index)) })
}
}
unsafe impl crate::depot::raw::Compact for links::Index {
const MAX: u32 = u32::MAX - 1;
fn into_raw(self) -> u32 {
self.raw()
}
unsafe fn from_raw(raw: u32) -> Self {
unsafe { Self::new_raw(raw) }
}
}
unsafe impl crate::depot::raw::Count<links::Index> for capacity::Count {
fn count(self) -> capacity::Count {
self
}
}