From 60fdb875cfd5e0de792f4fe5886aedeb9a4c348e Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Mon, 29 Aug 2022 08:07:26 -0400 Subject: [PATCH] Make it easier to debug Scopes --- leptos_reactive/src/scope.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/leptos_reactive/src/scope.rs b/leptos_reactive/src/scope.rs index a07ecc677..08eb836e9 100644 --- a/leptos_reactive/src/scope.rs +++ b/leptos_reactive/src/scope.rs @@ -1,6 +1,6 @@ use crate::{ - AnyEffect, AnySignal, EffectId, EffectState, ResourceId, ResourceState, Runtime, SignalId, - SignalState, + AnyEffect, AnySignal, EffectId, EffectState, ReadSignal, ResourceId, ResourceState, Runtime, + SignalId, SignalState, WriteSignal, }; use elsa::FrozenVec; use std::{ @@ -24,6 +24,10 @@ pub struct Scope { } impl Scope { + pub fn id(&self) -> ScopeId { + self.id + } + pub fn child_scope(self, f: impl FnOnce(Scope)) -> ScopeDisposer { self.runtime.create_scope(f, Some(self)) } @@ -95,7 +99,7 @@ impl Debug for ScopeDisposer { } } -slotmap::new_key_type! { pub(crate) struct ScopeId; } +slotmap::new_key_type! { pub struct ScopeId; } pub(crate) struct ScopeState { pub(crate) parent: Option,