@@ -37,28 +37,39 @@ impl<Args, Output: Default> Default for OpQueue<Args, Output> {
3737}
3838
3939impl < Args , Output > OpQueue < Args , Output > {
40+ /// Request an operation to start.
4041 pub ( crate ) fn request_op ( & mut self , reason : Cause , args : Args ) {
4142 self . op_requested = Some ( ( reason, args) ) ;
4243 }
44+
45+ /// If there was an operation requested, mark this queue as
46+ /// started and return the request arguments.
4347 pub ( crate ) fn should_start_op ( & mut self ) -> Option < ( Cause , Args ) > {
4448 if self . op_in_progress {
4549 return None ;
4650 }
4751 self . op_in_progress = self . op_requested . is_some ( ) ;
4852 self . op_requested . take ( )
4953 }
54+
55+ /// Mark an operation as completed.
5056 pub ( crate ) fn op_completed ( & mut self , result : Output ) {
5157 assert ! ( self . op_in_progress) ;
5258 self . op_in_progress = false ;
5359 self . last_op_result = result;
5460 }
5561
62+ /// Get the result of the last operation.
5663 pub ( crate ) fn last_op_result ( & self ) -> & Output {
5764 & self . last_op_result
5865 }
66+
67+ // Is there an operation that has started, but hasn't yet finished?
5968 pub ( crate ) fn op_in_progress ( & self ) -> bool {
6069 self . op_in_progress
6170 }
71+
72+ // Has an operation been requested?
6273 pub ( crate ) fn op_requested ( & self ) -> bool {
6374 self . op_requested . is_some ( )
6475 }
0 commit comments