mod path;
pub mod raw;
pub(in crate::depot) use path::Path;
use crate::depot::heap;
pub struct At<S, V = ()> {
owner: S,
position: usize,
next: V,
}
impl<S, V> At<S, V> {
pub(in crate::depot) fn new(owner: S, position: usize, next: V) -> Self {
Self {
owner,
position,
next,
}
}
pub fn into_inner(self) -> (S, usize, V) {
(self.owner, self.position, self.next)
}
}
pub struct Step<'a, S: raw::Source> {
pub(in crate::depot) hole: &'a mut heap::raw::Hole<S>,
pub(in crate::depot) source: usize,
}
impl<'a, S: raw::Source> Step<'a, S> {
pub(in crate::depot) fn shift(self) {
let Self { hole, source } = self;
S::shift(Step {
hole: &mut *hole,
source,
});
hole.position = source;
}
pub fn into_inner(self) -> (&'a mut S, usize, usize) {
(&mut self.hole.owner, self.source, self.hole.position)
}
}
pub struct Finish<S: raw::Source> {
pub(in crate::depot) hole: heap::raw::Hole<S>,
}
impl<S: raw::Source> Finish<S> {
pub fn into_inner(self) -> (S, usize, S::Value) {
let heap::raw::Hole {
owner,
position,
value,
} = self.hole;
(owner, position, value)
}
}