@@ -63,14 +63,17 @@ use {
6363/// Scopes manage:
6464/// - The metrics name for each pipeline and its nested pipelines
6565/// - Limits calculation and renewal for pipeline steps.
66- pub struct RootScope < P : Platform > {
66+ pub ( crate ) struct RootScope < P : Platform > {
6767 root : RwLock < Scope < P > > ,
6868 current : RefCell < StepPath > ,
6969}
7070
7171impl < P : Platform > RootScope < P > {
7272 /// Initialize all scopes in a given top-level pipeline.
73- pub fn new ( pipeline : & Pipeline < P > , init_checkpoint : & Checkpoint < P > ) -> Self {
73+ pub ( crate ) fn new (
74+ pipeline : & Pipeline < P > ,
75+ init_checkpoint : & Checkpoint < P > ,
76+ ) -> Self {
7477 let current = RefCell :: new ( StepPath :: empty ( ) ) ;
7578 let root = Scope :: rooted_at ( pipeline, init_checkpoint) ;
7679 let root = RwLock :: new ( root) ;
@@ -79,7 +82,7 @@ impl<P: Platform> RootScope<P> {
7982 }
8083
8184 /// Given a path to a step in the pipeline, returns its current limits.
82- pub fn limits_of ( & self , step_path : & StepPath ) -> Option < Limits > {
85+ pub ( crate ) fn limits_of ( & self , step_path : & StepPath ) -> Option < Limits > {
8386 self
8487 . root
8588 . read ( )
@@ -88,7 +91,7 @@ impl<P: Platform> RootScope<P> {
8891 }
8992
9093 /// Returns the instant when the scope was last entered.
91- pub fn entered_at ( & self , step_path : & StepPath ) -> Option < Instant > {
94+ pub ( crate ) fn entered_at ( & self , step_path : & StepPath ) -> Option < Instant > {
9295 self
9396 . root
9497 . read ( )
@@ -100,7 +103,7 @@ impl<P: Platform> RootScope<P> {
100103 /// It detects if the next step is in a different scope and enters and leaves
101104 /// scopes accordingly. This will leave and enter all intermediate scopes
102105 /// between the previous and next steps.
103- pub fn switch_context (
106+ pub ( crate ) fn switch_context (
104107 & self ,
105108 next_step : & StepPath ,
106109 checkpoint : & Checkpoint < P > ,
@@ -132,18 +135,18 @@ impl<P: Platform> RootScope<P> {
132135 }
133136 }
134137
135- pub fn enter ( & self , checkpoint : & Checkpoint < P > ) {
138+ pub ( crate ) fn enter ( & self , checkpoint : & Checkpoint < P > ) {
136139 let mut root = self . root . write ( ) ;
137140 let limits = root. limits ;
138141 root. enter ( checkpoint, & limits) ;
139142 }
140143
141- pub fn leave ( & self ) {
144+ pub ( crate ) fn leave ( & self ) {
142145 let mut root = self . root . write ( ) ;
143146 root. leave ( ) ;
144147 }
145148
146- pub fn is_active ( & self ) -> bool {
149+ pub ( crate ) fn is_active ( & self ) -> bool {
147150 self . root . read ( ) . is_active ( )
148151 }
149152}
@@ -165,7 +168,7 @@ fn scope_of(step: &StepPath) -> StepPath {
165168/// execution. All steps in a pipeline run within the scopes of the pipelines
166169/// that contain it. When a scope is active, then all its parent scopes are
167170/// active as well.
168- pub struct Scope < P : Platform > {
171+ pub ( crate ) struct Scope < P : Platform > {
169172 limits : Limits ,
170173 metrics : Metrics ,
171174 limits_factory : Option < Arc < dyn ScopedLimits < P > > > ,
@@ -178,23 +181,23 @@ pub struct Scope<P: Platform> {
178181impl < P : Platform > Scope < P > {
179182 /// When a scope is active it means that one of its steps (or in its nested
180183 /// scopes) is currently being executed,
181- pub const fn is_active ( & self ) -> bool {
184+ pub ( crate ) const fn is_active ( & self ) -> bool {
182185 self . entered_at . is_some ( )
183186 }
184187
185188 /// Returns the elapsed time since the scope was entered.
186189 /// This will only return a value if the scope is currently active.
187- pub fn elapsed ( & self ) -> Option < Duration > {
190+ pub ( crate ) fn elapsed ( & self ) -> Option < Duration > {
188191 self . entered_at . map ( |start| start. elapsed ( ) )
189192 }
190193
191194 /// Returns when the scope was entered most recently.
192- pub fn started_at ( & self ) -> Option < Instant > {
195+ pub ( crate ) fn started_at ( & self ) -> Option < Instant > {
193196 self . entered_at
194197 }
195198
196199 /// Returns the payload limits for steps running within the current scope.
197- pub const fn limits ( & self ) -> & Limits {
200+ pub ( crate ) const fn limits ( & self ) -> & Limits {
198201 & self . limits
199202 }
200203}
@@ -353,7 +356,7 @@ unsafe impl<P: Platform> Send for Scope<P> {}
353356unsafe impl < P : Platform > Sync for Scope < P > { }
354357
355358#[ derive( MetricsSet ) ]
356- pub struct Metrics {
359+ pub ( crate ) struct Metrics {
357360 /// Histogram of the number of iterations.
358361 pub iter_count_histogram : Histogram ,
359362
0 commit comments