diff --git a/src/lib.rs b/src/lib.rs index 44d90106..b855e20c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -291,7 +291,7 @@ where #[derive(Debug, Clone)] pub enum Interrupted

where - P: Clone + Send + Sync + Debug, + P: Share, { OsSignal, User { payload: Option

}, @@ -301,14 +301,14 @@ where #[derive(Debug, Clone)] pub struct Terminator

where - P: Clone + Send + Sync + Debug, + P: Share, { interrupt_tx: broadcast::Sender>, } impl

Terminator

where - P: Clone + Send + Sync + Debug + 'static, + P: Share, { /// Create a `Terminator` that stores the sending end of a broadcast channel. pub fn new(interrupt_tx: broadcast::Sender>) -> Self { @@ -327,7 +327,7 @@ where #[cfg(unix)] async fn terminate_by_unix_signal

(mut terminator: Terminator

) where - P: Clone + Send + Sync + Debug + 'static, + P: Share, { let mut interrupt_signal = signal(tokio::signal::unix::SignalKind::interrupt()) .expect("failed to create interrupt signal stream"); @@ -342,7 +342,7 @@ where /// Create a broadcast channel and spawn a task for retrieving the applications' kill signal. pub fn create_termination

() -> (Terminator

, broadcast::Receiver>) where - P: Clone + Send + Sync + Debug + 'static, + P: Share, { let (tx, rx) = broadcast::channel(1); let terminator = Terminator::new(tx); diff --git a/src/terminal.rs b/src/terminal.rs index 80813baa..c5d5ae34 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1,4 +1,3 @@ -use std::fmt::Debug; use std::io; use std::io::Write; use std::thread; @@ -15,9 +14,11 @@ use termion::async_stdin; use termion::input::TermRead; use termion::raw::{IntoRawMode, RawTerminal}; +use ratatui::prelude::*; use ratatui::termion::screen::{AlternateScreen, IntoAlternateScreen}; -use ratatui::{prelude::*, CompletedFrame}; -use ratatui::{TerminalOptions, Viewport}; +use ratatui::{CompletedFrame, TerminalOptions, Viewport}; + +use crate::Share; use super::event::Event; use super::Interrupted; @@ -173,7 +174,7 @@ impl ratatui::backend::Backend for TermionBackendExt { pub struct StdinReader {} impl StdinReader { - pub async fn run( + pub async fn run( self, event_tx: UnboundedSender, mut interrupt_rx: broadcast::Receiver>, diff --git a/src/ui/im.rs b/src/ui/im.rs index ebe5c57b..a1c2771a 100644 --- a/src/ui/im.rs +++ b/src/ui/im.rs @@ -22,7 +22,7 @@ use crate::store::Update; use crate::terminal::Terminal; use crate::ui::theme::Theme; use crate::ui::{Column, Spacing, ToRow}; -use crate::Interrupted; +use crate::{Interrupted, Share}; use crate::ui::im::widget::Widget; @@ -51,8 +51,8 @@ impl Frontend { ) -> anyhow::Result> where S: Update + Show, - M: Clone, - R: Clone + Send + Sync + Debug, + M: Share, + R: Share, { let mut ticker = tokio::time::interval(RENDERING_TICK_RATE); let mut terminal = Terminal::try_from(viewport)?; diff --git a/src/ui/rm.rs b/src/ui/rm.rs index 710cb889..482d8d90 100644 --- a/src/ui/rm.rs +++ b/src/ui/rm.rs @@ -1,18 +1,19 @@ pub mod widget; -use std::fmt::Debug; use std::time::Duration; -use ratatui::Viewport; use tokio::sync::broadcast; use tokio::sync::mpsc::UnboundedReceiver; +use ratatui::Viewport; + use crate::event::Event; use crate::store::Update; use crate::terminal::Terminal; use crate::ui::rm::widget::RenderProps; use crate::ui::rm::widget::Widget; use crate::Interrupted; +use crate::Share; const RENDERING_TICK_RATE: Duration = Duration::from_millis(250); @@ -49,8 +50,8 @@ impl Frontend { ) -> anyhow::Result> where S: Update + 'static, - M: 'static, - R: Clone + Send + Sync + Debug, + M: Share, + R: Share, { let mut ticker = tokio::time::interval(RENDERING_TICK_RATE); let mut terminal = Terminal::try_from(viewport)?;