use std::{marker, ptr};
use crate::link::egress::load::credit::wait::tree;
pub(in crate::link::egress::load::credit::wait) struct Nodes<'a> {
pub(super) pointer: ptr::NonNull<tree::Node>,
pub(super) borrow: marker::PhantomData<&'a mut [tree::Node]>,
}
pub(in crate::link::egress::load::credit::wait) struct NodeView<'a> {
pub(super) pointer: ptr::NonNull<tree::Node>,
pub(super) borrow: marker::PhantomData<&'a [tree::Node]>,
}
impl Nodes<'_> {
pub(in crate::link::egress::load::credit::wait) fn get(
&self,
index: tree::Index,
) -> &tree::Node {
unsafe { &*self.pointer.as_ptr().add(index.offset()) }
}
pub(in crate::link::egress::load::credit::wait) fn get_mut(
&mut self,
index: tree::Index,
) -> &mut tree::Node {
unsafe { &mut *self.pointer.as_ptr().add(index.offset()) }
}
}
impl NodeView<'_> {
pub(in crate::link::egress::load::credit::wait) fn get(
&self,
index: tree::Index,
) -> &tree::Node {
unsafe { &*self.pointer.as_ptr().add(index.offset()) }
}
}