From 4844693ceac387fddfe18b01f9b975626ae47619 Mon Sep 17 00:00:00 2001 From: Rupert Rutledge Date: Sun, 26 Apr 2020 20:30:14 +0100 Subject: Running cargo fmt --- src/display/components/layout.rs | 2 +- src/display/components/total_bandwidth.rs | 12 ++++++------ src/display/ui.rs | 3 ++- src/main.rs | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/display/components/layout.rs b/src/display/components/layout.rs index c86211a..6c9812d 100644 --- a/src/display/components/layout.rs +++ b/src/display/components/layout.rs @@ -2,9 +2,9 @@ use ::tui::backend::Backend; use ::tui::layout::{Constraint, Direction, Rect}; use ::tui::terminal::Frame; +use super::HeaderDetails; use super::HelpText; use super::Table; -use super::HeaderDetails; const FIRST_HEIGHT_BREAKPOINT: u16 = 30; const FIRST_WIDTH_BREAKPOINT: u16 = 120; diff --git a/src/display/components/total_bandwidth.rs b/src/display/components/total_bandwidth.rs index a1968e5..095247b 100644 --- a/src/display/components/total_bandwidth.rs +++ b/src/display/components/total_bandwidth.rs @@ -46,8 +46,8 @@ impl<'a> HeaderDetails<'a> { }; Paragraph::new(title_text.iter()) - .alignment(Alignment::Left) - .render(frame, rect); + .alignment(Alignment::Left) + .render(frame, rect); } fn render_elapsed_time(&self, frame: &mut Frame, rect: Rect) { @@ -59,11 +59,11 @@ impl<'a> HeaderDetails<'a> { self.elapsed_time.as_secs() % 60 ), Style::default() - .fg(Color::LightBlue) - .modifier(Modifier::BOLD), + .fg(Color::LightBlue) + .modifier(Modifier::BOLD), )]; Paragraph::new(elapsed_time_text.iter()) - .alignment(Alignment::Right) - .render(frame, rect); + .alignment(Alignment::Right) + .render(frame, rect); } } diff --git a/src/display/ui.rs b/src/display/ui.rs index 21ae49d..54db7fb 100644 --- a/src/display/ui.rs +++ b/src/display/ui.rs @@ -3,7 +3,7 @@ use ::std::collections::HashMap; use ::tui::backend::Backend; use ::tui::Terminal; -use crate::display::components::{HelpText, Layout, Table, HeaderDetails}; +use crate::display::components::{HeaderDetails, HelpText, Layout, Table}; use crate::display::UIState; use crate::network::{display_connection_string, display_ip_or_host, LocalSocket, Utilization}; @@ -79,6 +79,7 @@ where )); } } + pub fn draw(&mut self, paused: bool, show_dns: bool, elapsed_time: std::time::Duration) { let state = &self.state; let children = self.get_tables_to_display(); diff --git a/src/main.rs b/src/main.rs index d12f946..0ecd3ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,8 +28,8 @@ use ::std::io; use ::std::time::Instant; use ::termion::raw::IntoRawMode; use ::tui::backend::TermionBackend; -use structopt::StructOpt; use std::sync::RwLock; +use structopt::StructOpt; const DISPLAY_DELTA: time::Duration = time::Duration::from_millis(1000); @@ -245,7 +245,8 @@ where *last_start_time.write().unwrap() = Instant::now(); } else { let last_start_time_copy = *last_start_time.read().unwrap(); - let current_cumulative_time_copy = *cumulative_time.read().unwrap(); + let current_cumulative_time_copy = + *cumulative_time.read().unwrap(); let new_cumulative_time = current_cumulative_time_copy + last_start_time_copy.elapsed(); *cumulative_time.write().unwrap() = new_cumulative_time; -- cgit v1.2.3