File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ impl Configuration {
5353
5454 opts
5555 }
56-
56+
5757 /// Constructs a new configuration by parsing supplied text arguments.
5858 ///
5959 /// Most commonly, this uses `std::env::Args()` as the supplied iterator.
@@ -281,11 +281,21 @@ pub struct WorkerGuards<T:Send+'static> {
281281}
282282
283283impl < T : Send +' static > WorkerGuards < T > {
284+
285+ /// Returns the number of guards.
286+ pub fn len ( & self ) -> usize { self . guards . len ( ) }
287+
288+ /// Returns a reference to the indexed guard.
289+ pub fn guard ( & self , index : usize ) -> & std:: thread:: JoinHandle < T > {
290+ & self . guards [ index]
291+ }
292+
284293 /// Waits on the worker threads and returns the results they produce.
285294 pub fn join ( mut self ) -> Vec < Result < T , String > > {
286- self . guards . drain ( ..)
287- . map ( |guard| guard. join ( ) . map_err ( |e| format ! ( "{:?}" , e) ) )
288- . collect ( )
295+ self . guards
296+ . drain ( ..)
297+ . map ( |guard| guard. join ( ) . map_err ( |e| format ! ( "{:?}" , e) ) )
298+ . collect ( )
289299 }
290300}
291301
You can’t perform that action at this time.
0 commit comments