use std::pin;
use cycle::Policy;
use crate::depot::arena::slab::{entries, entry, key::cycle, storage};
pub type Anchored<
'a,
T,
Tag = (),
const MAX: u32 = { u32::MAX },
const RECYCLE: bool = false,
const PARTITIONS: usize = 1,
S = storage::Heap,
> = entry::Slot<
entries::Busy<'a, T, MAX, entries::Exclusive<RECYCLE>, PARTITIONS, (), S>,
Tag,
true,
entry::Pinned,
>;
impl<'a, T, Tag, const MAX: u32, const RECYCLE: bool, const PARTITIONS: usize, S>
Anchored<'a, T, Tag, MAX, RECYCLE, PARTITIONS, S>
where
cycle::Mode<RECYCLE>: Policy,
S: storage::Storage,
{
pub fn get(&self) -> &T {
self.entry.value()
}
pub fn value(&mut self) -> pin::Pin<&mut T> {
unsafe { pin::Pin::new_unchecked(self.entry.value_mut()) }
}
pub fn into_value(self) -> pin::Pin<&'a mut T> {
unsafe { pin::Pin::new_unchecked(self.entry.into_mut()) }
}
}