use std::cell::Cell;
#[cfg(debug_assertions)]
thread_local! {
static BORROW_ORDER: std::cell::Cell<u8> = const { std::cell::Cell::new(0) };
}
#[cfg(debug_assertions)]
pub(super) fn reset_borrow_order() {
BORROW_ORDER.with(|c| c.set(0));
}
#[cfg(not(debug_assertions))]
pub(super) fn reset_borrow_order() {}
pub(super) struct RenderingGuard<'a>(pub(super) &'a Cell<bool>);
impl Drop for RenderingGuard<'_> {
fn drop(&mut self) {
self.0.set(false);
}
}
pub(super) struct SyncResizeGuard<'a>(&'a Cell<bool>);
impl<'a> SyncResizeGuard<'a> {
pub(super) fn new(flag: &'a Cell<bool>) -> Self {
flag.set(true);
Self(flag)
}
}
impl Drop for SyncResizeGuard<'_> {
fn drop(&mut self) {
self.0.set(false);
}
}