File tree 1 file changed +20
-0
lines changed
src/tools/rust-analyzer/crates/rust-analyzer/src
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
pub ( crate ) type Cause = String ;
5
5
6
+ /// A single-item queue that allows callers to request an operation to
7
+ /// be performed later.
8
+ ///
9
+ /// ```
10
+ /// let queue = OpQueue::default();
11
+ ///
12
+ /// // Request work to be done.
13
+ /// queue.request_op("user pushed a button", ());
14
+ ///
15
+ /// // In a later iteration of the server loop, we start the work.
16
+ /// if let Some((_cause, ())) = queue.should_start_op() {
17
+ /// dbg!("Some slow operation here");
18
+ /// }
19
+ ///
20
+ /// // In an even later iteration of the server loop, we can see that the work
21
+ /// // was completed.
22
+ /// if !queue.op_in_progress() {
23
+ /// dbg!("Work has been done!");
24
+ /// }
25
+ /// ```
6
26
#[ derive( Debug ) ]
7
27
pub ( crate ) struct OpQueue < Args = ( ) , Output = ( ) > {
8
28
op_requested : Option < ( Cause , Args ) > ,
You can’t perform that action at this time.
0 commit comments