use crate::{
alloc,
depot::{
self, capacity,
queue::{
indexed::planes::{bound, resident},
links,
},
},
mem::{self, slot},
};
unsafe impl<'storage, 'id, T, M, const N: usize, P: Ord, C: alloc::raw::Extent, const E: usize>
depot::raw::Project<
links::Index,
resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>,
> for bound::Scope<'storage, 'id, slot::Storage<T, M>, N, bound::Active<'storage, P, C>>
{
type Output = (
resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>,
resident::Key<'id>,
);
unsafe fn project(self, index: links::Index) -> Self::Output {
let key = bound::ActiveKey(capacity::Key::new(unsafe { depot::raw::Proof::new(index) }));
(self.resident(), resident::Key(key))
}
}
unsafe impl<
'loan,
'storage,
'id,
T,
M,
const N: usize,
P: Ord,
C: alloc::raw::Extent,
const E: usize,
>
depot::raw::Project<
links::Index,
resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>,
>
for &'loan bound::Scope<'storage, 'id, slot::Storage<T, M>, N, bound::Active<'storage, P, C>>
{
type Output = &'loan T;
unsafe fn project(self, index: links::Index) -> Self::Output {
let key = bound::ActiveKey(capacity::Key::new(unsafe { depot::raw::Proof::new(index) }));
unsafe { mem::raw::project(self.get(key)) }
}
}
unsafe impl<
'loan,
'storage,
'id,
T,
M,
const N: usize,
P: Ord,
C: alloc::raw::Extent,
const E: usize,
>
depot::raw::Project<
links::Index,
resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>,
> for &'loan resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>
{
type Output = &'loan T;
unsafe fn project(self, index: links::Index) -> Self::Output {
unsafe {
depot::raw::Project::<
links::Index,
resident::Scope<'storage, 'id, T, M, N, bound::Active<'storage, P, C>, E>,
>::project(&self.source, index)
}
}
}