about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilfred Hughes <wilfred@meta.com>2024-08-28 16:29:18 -0700
committerWilfred Hughes <wilfred@meta.com>2024-08-28 16:29:18 -0700
commite691f6d040321b9c872ab702ecf115bbd747957a (patch)
tree6358469b063fbb0d90dbec476439cd846fbcc72b
parent199c01df7a138694387a8635e7b10a0ff1578d14 (diff)
downloadrust-e691f6d040321b9c872ab702ecf115bbd747957a.tar.gz
rust-e691f6d040321b9c872ab702ecf115bbd747957a.zip
internal: Add doc comments to OpQueue
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/op_queue.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/op_queue.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/op_queue.rs
index eab97338724..5c4c858e150 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/op_queue.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/op_queue.rs
@@ -37,9 +37,13 @@ impl<Args, Output: Default> Default for OpQueue<Args, Output> {
 }
 
 impl<Args, Output> OpQueue<Args, Output> {
+    /// Request an operation to start.
     pub(crate) fn request_op(&mut self, reason: Cause, args: Args) {
         self.op_requested = Some((reason, args));
     }
+
+    /// If there was an operation requested, mark this queue as
+    /// started and return the request arguments.
     pub(crate) fn should_start_op(&mut self) -> Option<(Cause, Args)> {
         if self.op_in_progress {
             return None;
@@ -47,18 +51,25 @@ impl<Args, Output> OpQueue<Args, Output> {
         self.op_in_progress = self.op_requested.is_some();
         self.op_requested.take()
     }
+
+    /// Mark an operation as completed.
     pub(crate) fn op_completed(&mut self, result: Output) {
         assert!(self.op_in_progress);
         self.op_in_progress = false;
         self.last_op_result = result;
     }
 
+    /// Get the result of the last operation.
     pub(crate) fn last_op_result(&self) -> &Output {
         &self.last_op_result
     }
+
+    // Is there an operation that has started, but hasn't yet finished?
     pub(crate) fn op_in_progress(&self) -> bool {
         self.op_in_progress
     }
+
+    // Has an operation been requested?
     pub(crate) fn op_requested(&self) -> bool {
         self.op_requested.is_some()
     }