diff --git a/src/tui/mod.rs b/src/tui/mod.rs index 8132e8f..36144a5 100644 --- a/src/tui/mod.rs +++ b/src/tui/mod.rs @@ -6,18 +6,18 @@ use tokio::time::sleep; use crate::{SharedData}; use crate::post_history::{PostHistory, PostHistoryInner}; -pub(crate) async fn run<'a>(shared_data: Arc>) { +pub(crate) async fn run(shared_data: Arc>) { let mut min_len_series: u32 = 0; let mut min_len_slug: u32 = 0; println!("TUI restarted"); loop { - let snapshot_data = shared_data.read().await; sleep(Duration::milliseconds(250).to_std().unwrap()).await; - print_info(snapshot_data, &mut min_len_series, &mut min_len_slug).await; + print_info(&shared_data, &mut min_len_series, &mut min_len_slug).await; } } -async fn print_info<'a>(data: RwLockReadGuard<'a, SharedData>, min_len_series: &mut u32, min_len_slug: &mut u32) { +async fn print_info(arc_data: &Arc>, min_len_series: &mut u32, min_len_slug: &mut u32) { + let data = arc_data.read().await; let mut local_min_len_series = *min_len_series.deref() as usize; let mut local_min_len_slug = *min_len_slug.deref() as usize; let separator_width = local_min_len_slug + local_min_len_series + 44; // 44 should account for length of every other string