From 3cd60c5b012c2be3e78564a27619c0eb02dda23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 12 Mar 2025 13:30:07 +0100 Subject: [PATCH] doc(multiverse): Document the status widget a bit better --- labs/multiverse/src/widgets/status.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/labs/multiverse/src/widgets/status.rs b/labs/multiverse/src/widgets/status.rs index 6cea462e1..8b4b547c7 100644 --- a/labs/multiverse/src/widgets/status.rs +++ b/labs/multiverse/src/widgets/status.rs @@ -25,14 +25,23 @@ pub struct Status { /// Content of the latest status message, if set. last_status_message: Arc>>, + /// An [mpsc::Sender] that other widgets can use to change the status + /// message. message_sender: mpsc::Sender, + /// The task listening for messages to be received over the + /// [mpsc::Receiver]. _receiver_task: JoinHandle<()>, + /// A copy of the [`DetailsMode`] set by the main application. mode: DetailsMode, + + /// A copy of the [`GlobalMode`] set by the main application. global_mode: GlobalMode, } +/// A handle to the [`Status`] widget, this handle can be moved to different +/// threads where it can be used to set the status message. pub struct StatusHandle { message_sender: mpsc::Sender, } @@ -110,6 +119,8 @@ impl Status { self.global_mode = mode; } + /// Get a handle to the [`Status`] widget, this can be used to set the + /// status message from a separate thread. pub fn handle(&self) -> StatusHandle { StatusHandle { message_sender: self.message_sender.clone() } }