Remove lifetime from TUI module
This commit is contained in:
parent
f22e2d6278
commit
2531af3739
1 changed files with 4 additions and 4 deletions
|
@ -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<RwLock<SharedData>>) {
|
||||
pub(crate) async fn run(shared_data: Arc<RwLock<SharedData>>) {
|
||||
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<RwLock<SharedData>>, 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
|
||||
|
|
Loading…
Reference in a new issue