This commit is contained in:
parent
265f8d8dc3
commit
450183c06b
5 changed files with 419 additions and 70 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::{future::Future, time::Duration};
|
||||
use std::{cell::OnceCell, future::Future, rc::Rc, time::Duration};
|
||||
|
||||
use futures_util::FutureExt;
|
||||
use ratatui::crossterm::event;
|
||||
|
@ -10,9 +10,9 @@ impl AppExecutor for TokioExecutor {
|
|||
fn execute<T: 'static>(
|
||||
&self,
|
||||
future: impl Future<Output = T> + 'static,
|
||||
sender: std::sync::mpsc::Sender<T>,
|
||||
output_cell: Rc<OnceCell<T>>,
|
||||
) {
|
||||
tokio::task::spawn_local(future.map(move |output| sender.send(output).unwrap()));
|
||||
tokio::task::spawn_local(future.map(move |output| output_cell.set(output)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue