use super::ThreadState;
#[cfg(all(test, feature = "loom-tests"))]
use super::{EnvLockOps, ThreadStateCore};
#[cfg(all(test, feature = "loom-tests"))]
impl<L: EnvLockOps> ThreadStateCore<L> {
pub(crate) const fn depth(&self) -> usize { self.depth }
pub(crate) fn is_stack_empty(&self) -> bool { self.stack.is_empty() }
pub(crate) const fn has_lock(&self) -> bool { self.lock.is_some() }
pub(crate) fn with_lock_guard<R>(&self, inspect: impl FnOnce(&L::Guard) -> R) -> R {
let Some(guard) = self.lock.as_ref() else {
panic!("ScopedEnv should hold the mutex during active inspection");
};
inspect(guard)
}
}
#[cfg(test)]
impl ThreadState {
pub const fn depth(&self) -> usize { self.inner.depth }
pub fn is_stack_empty(&self) -> bool { self.inner.stack.is_empty() }
pub const fn has_lock(&self) -> bool { self.inner.lock.is_some() }
}