Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/profile/src/lib.rs')
| -rw-r--r-- | crates/profile/src/lib.rs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/crates/profile/src/lib.rs b/crates/profile/src/lib.rs index 3639981560..a3fdb72a6d 100644 --- a/crates/profile/src/lib.rs +++ b/crates/profile/src/lib.rs @@ -23,29 +23,6 @@ pub use countme::Count; thread_local!(static IN_SCOPE: RefCell<bool> = const { RefCell::new(false) }); -/// Allows to check if the current code is within some dynamic scope, can be -/// useful during debugging to figure out why a function is called. -pub struct Scope { - prev: bool, -} - -impl Scope { - #[must_use] - pub fn enter() -> Scope { - let prev = IN_SCOPE.with(|slot| std::mem::replace(&mut *slot.borrow_mut(), true)); - Scope { prev } - } - pub fn is_active() -> bool { - IN_SCOPE.with(|slot| *slot.borrow()) - } -} - -impl Drop for Scope { - fn drop(&mut self) { - IN_SCOPE.with(|slot| *slot.borrow_mut() = self.prev); - } -} - /// A wrapper around google_cpu_profiler. /// /// Usage: |