Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
lib: Pass boxed widget to tui::run
Erik Kundt committed 1 year ago
commit a29d1d6895356962cfc5abf0eabcf17851788585
parent 369616abd150e7d70017c93cbd7bc4110a8d1516
1 file changed +2 -2
modified src/lib.rs
@@ -120,7 +120,7 @@ impl<A> Default for Channel<A> {
/// Initialize a `Store` with the `State` given and a `Frontend` with the `Widget` given,
/// and run their main loops concurrently. Connect them to the `Channel` and also to
/// an interrupt broadcast channel also initialized in this function.
-
pub async fn run<S, M, W, P>(channel: Channel<M>, state: S, root: W) -> Result<Option<P>>
+
pub async fn run<S, M, W, P>(channel: Channel<M>, state: S, root: Box<W>) -> Result<Option<P>>
where
    S: State<P, Message = M> + Clone + Debug + Send + Sync + 'static,
    W: Widget<State = S, Message = M>,
@@ -133,7 +133,7 @@ where

    tokio::try_join!(
        store.main_loop(state, terminator, channel.rx, interrupt_rx.resubscribe()),
-
        frontend.main_loop(Some(root), state_rx, interrupt_rx.resubscribe()),
+
        frontend.main_loop(Some(*root), state_rx, interrupt_rx.resubscribe()),
    )?;

    if let Ok(reason) = interrupt_rx.recv().await {