use crate::api::work;
use std::mem;
use work::{Depth, depth::Count};
pub(crate) struct Release<'source> {
source: &'source Depth,
current: Count,
}
impl<'source> Release<'source> {
pub(crate) unsafe fn new(source: &'source Depth) -> Self {
let current = unsafe { *source.0.get().as_slice().get_unchecked(0) };
Self { source, current }
}
pub(crate) const fn depth(&self) -> Count {
self.current
}
pub(crate) fn close(self) {
self.source.0.set(self.current.prior().nonzero());
}
}
const _: () = assert!(mem::size_of::<Release<'_>>() == 2 * mem::size_of::<usize>());