refactor: somewhat migrate to Rust 2024 edition (#1681)
* refactor: try bumping to rust 2024 edition * now run nightly fmt * fix some macos changes * only apply a few of these settings
This commit is contained in:
parent
9999a4824a
commit
f7d070f944
2
build.rs
2
build.rs
|
@ -10,7 +10,7 @@ use std::{
|
|||
};
|
||||
|
||||
use clap::{Command, CommandFactory};
|
||||
use clap_complete::{generate_to, shells::Shell, Generator};
|
||||
use clap_complete::{Generator, generate_to, shells::Shell};
|
||||
use clap_complete_fig::Fig;
|
||||
use clap_complete_nushell::Nushell;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ fn_params_layout = "Compressed"
|
|||
use_field_init_shorthand = true
|
||||
tab_spaces = 4
|
||||
max_width = 100
|
||||
style_edition = "2024"
|
||||
|
||||
# Unstable options, disabled by default.
|
||||
# imports_granularity = "Crate"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use std::{collections::BTreeMap, vec::Vec};
|
||||
|
||||
use crate::collection::processes::{Pid, ProcessHarvest};
|
||||
use hashbrown::HashMap;
|
||||
|
||||
use crate::collection::processes::{Pid, ProcessHarvest};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ProcessData {
|
||||
/// A PID to process data map.
|
||||
|
|
|
@ -3,18 +3,17 @@ use std::{
|
|||
vec::Vec,
|
||||
};
|
||||
|
||||
use super::{ProcessData, TimeSeriesData};
|
||||
#[cfg(feature = "battery")]
|
||||
use crate::collection::batteries;
|
||||
use crate::{
|
||||
app::AppConfigFields,
|
||||
collection::{cpu, disks, memory::MemData, network, Data},
|
||||
collection::{Data, cpu, disks, memory::MemData, network},
|
||||
dec_bytes_per_second_string,
|
||||
utils::data_units::DataUnit,
|
||||
widgets::{DiskWidgetData, TempWidgetData},
|
||||
};
|
||||
|
||||
use super::{ProcessData, TimeSeriesData};
|
||||
|
||||
/// A collection of data. This is where we dump data into.
|
||||
///
|
||||
/// TODO: Maybe reduce visibility of internal data, make it only accessible through DataStore?
|
||||
|
|
|
@ -663,21 +663,20 @@ impl BottomLayout {
|
|||
BottomLayout {
|
||||
total_row_height_ratio: 3,
|
||||
rows: vec![
|
||||
BottomRow::new(vec![BottomCol::new(vec![
|
||||
BottomColRow::new(vec![cpu]).canvas_handled()
|
||||
])
|
||||
.canvas_handled()])
|
||||
BottomRow::new(vec![
|
||||
BottomCol::new(vec![BottomColRow::new(vec![cpu]).canvas_handled()])
|
||||
.canvas_handled(),
|
||||
BottomRow::new(vec![BottomCol::new(vec![BottomColRow::new(vec![
|
||||
mem, net,
|
||||
])
|
||||
.canvas_handled()])
|
||||
.canvas_handled()])
|
||||
.canvas_handled(),
|
||||
BottomRow::new(vec![BottomCol::new(vec![
|
||||
BottomColRow::new(vec![table]).canvas_handled()
|
||||
BottomRow::new(vec![
|
||||
BottomCol::new(vec![BottomColRow::new(vec![mem, net]).canvas_handled()])
|
||||
.canvas_handled(),
|
||||
])
|
||||
.canvas_handled(),
|
||||
BottomRow::new(vec![
|
||||
BottomCol::new(vec![BottomColRow::new(vec![table]).canvas_handled()])
|
||||
.canvas_handled(),
|
||||
])
|
||||
.canvas_handled()])
|
||||
.canvas_handled(),
|
||||
BottomRow::new(table_widgets).canvas_handled(),
|
||||
],
|
||||
|
|
|
@ -6,7 +6,7 @@ use anyhow::bail;
|
|||
use windows::Win32::{
|
||||
Foundation::{CloseHandle, HANDLE},
|
||||
System::Threading::{
|
||||
OpenProcess, TerminateProcess, PROCESS_QUERY_INFORMATION, PROCESS_TERMINATE,
|
||||
OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_TERMINATE, TerminateProcess,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -68,9 +68,11 @@ pub fn kill_process_given_pid(pid: Pid, signal: usize) -> anyhow::Result<()> {
|
|||
let err_code = std::io::Error::last_os_error().raw_os_error();
|
||||
let err = match err_code {
|
||||
Some(libc::ESRCH) => "the target process did not exist.",
|
||||
Some(libc::EPERM) => "the calling process does not have the permissions to terminate the target process(es).",
|
||||
Some(libc::EPERM) => {
|
||||
"the calling process does not have the permissions to terminate the target process(es)."
|
||||
}
|
||||
Some(libc::EINVAL) => "an invalid signal was specified.",
|
||||
_ => "Unknown error occurred."
|
||||
_ => "Unknown error occurred.",
|
||||
};
|
||||
|
||||
if let Some(err_code) = err_code {
|
||||
|
|
|
@ -9,8 +9,8 @@ use crate::{
|
|||
app::layout_manager::BottomWidgetType,
|
||||
constants,
|
||||
widgets::{
|
||||
query::ProcessQuery, BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState,
|
||||
NetWidgetState, ProcWidgetState, TempWidgetState,
|
||||
BatteryWidgetState, CpuWidgetState, DiskTableWidget, MemWidgetState, NetWidgetState,
|
||||
ProcWidgetState, TempWidgetState, query::ProcessQuery,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@ mod widgets;
|
|||
|
||||
use itertools::izip;
|
||||
use tui::{
|
||||
Frame, Terminal,
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::Span,
|
||||
widgets::Paragraph,
|
||||
Frame, Terminal,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{
|
||||
layout_manager::{BottomColRow, BottomLayout, BottomWidgetType, IntermediaryConstraint},
|
||||
App,
|
||||
layout_manager::{BottomColRow, BottomLayout, BottomWidgetType, IntermediaryConstraint},
|
||||
},
|
||||
constants::*,
|
||||
options::config::style::Styles,
|
||||
|
@ -362,11 +362,7 @@ impl Painter {
|
|||
&& actual_cpu_data_len.saturating_sub(1) % 4 != 0,
|
||||
);
|
||||
|
||||
if c <= 1 {
|
||||
1
|
||||
} else {
|
||||
c
|
||||
}
|
||||
if c <= 1 { 1 } else { c }
|
||||
};
|
||||
|
||||
let mut mem_rows = 1;
|
||||
|
|
|
@ -5,10 +5,10 @@ use std::{
|
|||
|
||||
use concat_string::concat_string;
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Span, Text},
|
||||
widgets::{Block, Row, Table},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -17,7 +17,7 @@ use super::{
|
|||
};
|
||||
use crate::{
|
||||
app::layout_manager::BottomWidget,
|
||||
canvas::{drawing_utils::widget_block, Painter},
|
||||
canvas::{Painter, drawing_utils::widget_block},
|
||||
constants::TABLE_GAP_HEIGHT_LIMIT,
|
||||
utils::strings::truncate_to_text,
|
||||
};
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
mod time_chart;
|
||||
pub use time_chart::*;
|
||||
|
||||
use std::{borrow::Cow, time::Instant};
|
||||
|
||||
use concat_string::concat_string;
|
||||
pub use time_chart::*;
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Rect},
|
||||
style::Style,
|
||||
symbols::Marker,
|
||||
text::{Line, Span},
|
||||
widgets::{BorderType, GraphType},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{app::data::Values, canvas::drawing_utils::widget_block};
|
||||
|
|
|
@ -16,13 +16,13 @@ use tui::{
|
|||
style::{Color, Style, Styled},
|
||||
symbols::{self, Marker},
|
||||
text::{Line, Span},
|
||||
widgets::{block::BlockExt, Block, Borders, GraphType, Widget},
|
||||
widgets::{Block, Borders, GraphType, Widget, block::BlockExt},
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use crate::{
|
||||
app::data::Values,
|
||||
utils::general::{saturating_log10, saturating_log2},
|
||||
utils::general::{saturating_log2, saturating_log10},
|
||||
};
|
||||
|
||||
pub const DEFAULT_LEGEND_CONSTRAINTS: (Constraint, Constraint) =
|
||||
|
|
|
@ -22,8 +22,8 @@ use tui::{
|
|||
symbols,
|
||||
text::Line,
|
||||
widgets::{
|
||||
canvas::{Line as CanvasLine, Points},
|
||||
Block, Widget,
|
||||
canvas::{Line as CanvasLine, Points},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ use itertools::Itertools;
|
|||
use tui::{
|
||||
style::Color,
|
||||
widgets::{
|
||||
canvas::{Line as CanvasLine, Points},
|
||||
GraphType,
|
||||
canvas::{Line as CanvasLine, Points},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use tui::{
|
||||
Frame,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Span},
|
||||
widgets::{Block, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{layout_manager::BottomWidgetType, App},
|
||||
app::{App, layout_manager::BottomWidgetType},
|
||||
canvas::Painter,
|
||||
};
|
||||
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
use std::cmp::min;
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Span, Text},
|
||||
widgets::{Block, Paragraph, Wrap},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{App, KillSignal, MAX_PROCESS_SIGNAL},
|
||||
canvas::{drawing_utils::dialog_block, Painter},
|
||||
canvas::{Painter, drawing_utils::dialog_block},
|
||||
widgets::ProcWidgetMode,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use std::cmp::{max, min};
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Line, Span},
|
||||
widgets::{Paragraph, Wrap},
|
||||
Frame,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
canvas::{drawing_utils::dialog_block, Painter},
|
||||
canvas::{Painter, drawing_utils::dialog_block},
|
||||
constants::{self, HELP_TEXT},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use std::cmp::min;
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Span},
|
||||
widgets::{Cell, Paragraph, Row, Table, Tabs},
|
||||
Frame,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
canvas::{drawing_utils::widget_block, Painter},
|
||||
canvas::{Painter, drawing_utils::widget_block},
|
||||
collection::batteries::BatteryState,
|
||||
constants::*,
|
||||
};
|
||||
|
|
|
@ -2,16 +2,16 @@ use std::cmp::min;
|
|||
|
||||
use itertools::{Either, Itertools};
|
||||
use tui::{
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
canvas::{
|
||||
Painter,
|
||||
components::pipe_gauge::{LabelLimit, PipeGauge},
|
||||
drawing_utils::widget_block,
|
||||
Painter,
|
||||
},
|
||||
collection::cpu::{CpuData, CpuDataType},
|
||||
};
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
symbols::Marker,
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{data::StoredData, layout_manager::WidgetDirection, App},
|
||||
app::{App, data::StoredData, layout_manager::WidgetDirection},
|
||||
canvas::{
|
||||
Painter,
|
||||
components::{
|
||||
data_table::{DrawInfo, SelectionState},
|
||||
time_graph::{AxisBound, GraphData, TimeGraph},
|
||||
},
|
||||
drawing_utils::should_hide_x_label,
|
||||
Painter,
|
||||
},
|
||||
collection::cpu::CpuData,
|
||||
widgets::CpuWidgetState,
|
||||
|
@ -158,10 +158,12 @@ impl Painter {
|
|||
[(offset_position - show_avg_offset) % self.styles.cpu_colour_styles.len()]
|
||||
};
|
||||
|
||||
vec![GraphData::default()
|
||||
vec![
|
||||
GraphData::default()
|
||||
.style(style)
|
||||
.time(time)
|
||||
.values(&cpu_points[current_scroll_position - 1])]
|
||||
.values(&cpu_points[current_scroll_position - 1]),
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use tui::{layout::Rect, Frame};
|
||||
use tui::{Frame, layout::Rect};
|
||||
|
||||
use crate::{
|
||||
app,
|
||||
canvas::{
|
||||
components::data_table::{DrawInfo, SelectionState},
|
||||
Painter,
|
||||
components::data_table::{DrawInfo, SelectionState},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use tui::{
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
canvas::{components::pipe_gauge::PipeGauge, drawing_utils::widget_block, Painter},
|
||||
canvas::{Painter, components::pipe_gauge::PipeGauge, drawing_utils::widget_block},
|
||||
collection::memory::MemData,
|
||||
get_binary_unit_and_denominator,
|
||||
};
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
use std::{borrow::Cow, time::Instant};
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Rect},
|
||||
style::Style,
|
||||
symbols::Marker,
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{data::Values, App},
|
||||
app::{App, data::Values},
|
||||
canvas::{
|
||||
Painter,
|
||||
components::time_graph::{AxisBound, GraphData, TimeGraph},
|
||||
drawing_utils::should_hide_x_label,
|
||||
Painter,
|
||||
},
|
||||
collection::memory::MemData,
|
||||
get_binary_unit_and_denominator,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Line, Span},
|
||||
widgets::{Block, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
canvas::{drawing_utils::widget_block, Painter},
|
||||
canvas::{Painter, drawing_utils::widget_block},
|
||||
utils::data_units::{convert_bits, get_unit_prefix},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use tui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
symbols::Marker,
|
||||
text::Text,
|
||||
widgets::{Block, Borders, Row, Table},
|
||||
Frame,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
app::{App, AppConfigFields, AxisScaling},
|
||||
canvas::{
|
||||
Painter,
|
||||
components::time_graph::{AxisBound, ChartScaling, GraphData, TimeGraph},
|
||||
drawing_utils::should_hide_x_label,
|
||||
Painter,
|
||||
},
|
||||
utils::{
|
||||
data_units::*,
|
||||
general::{saturating_log10, saturating_log2},
|
||||
general::{saturating_log2, saturating_log10},
|
||||
},
|
||||
widgets::NetWidgetHeightCache,
|
||||
};
|
||||
|
@ -106,7 +106,7 @@ impl Painter {
|
|||
for (&time, &v) in rx_points
|
||||
.iter_along_base(time)
|
||||
.rev()
|
||||
.take_while(|(&time, _)| time >= first_time)
|
||||
.take_while(|&(&time, _)| time >= first_time)
|
||||
{
|
||||
if v > biggest {
|
||||
biggest = v;
|
||||
|
@ -117,7 +117,7 @@ impl Painter {
|
|||
for (&time, &v) in tx_points
|
||||
.iter_along_base(time)
|
||||
.rev()
|
||||
.take_while(|(&time, _)| time >= first_time)
|
||||
.take_while(|&(&time, _)| time >= first_time)
|
||||
{
|
||||
if v > biggest {
|
||||
biggest = v;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
use tui::{
|
||||
Frame,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
style::Style,
|
||||
text::{Line, Span},
|
||||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
use crate::{
|
||||
app::{App, AppSearchState},
|
||||
canvas::{
|
||||
Painter,
|
||||
components::data_table::{DrawInfo, SelectionState},
|
||||
drawing_utils::widget_block,
|
||||
Painter,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use tui::{layout::Rect, Frame};
|
||||
use tui::{Frame, layout::Rect};
|
||||
|
||||
use crate::{
|
||||
app,
|
||||
canvas::{
|
||||
components::data_table::{DrawInfo, SelectionState},
|
||||
Painter,
|
||||
components::data_table::{DrawInfo, SelectionState},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
mod amdgpu_marketing;
|
||||
|
||||
use crate::{
|
||||
app::{filter::Filter, layout_manager::UsedWidgets},
|
||||
collection::{memory::MemData, temperature::TempSensorData},
|
||||
};
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use std::{
|
||||
fs::{self, read_to_string},
|
||||
num::NonZeroU64,
|
||||
|
@ -13,6 +8,13 @@ use std::{
|
|||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
|
||||
use crate::{
|
||||
app::{filter::Filter, layout_manager::UsedWidgets},
|
||||
collection::{memory::MemData, temperature::TempSensorData},
|
||||
};
|
||||
|
||||
// TODO: May be able to clean up some of these, Option<Vec> for example is a bit redundant.
|
||||
pub struct AMDGPUData {
|
||||
pub memory: Option<Vec<(String, MemData)>>,
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
//! For more information, refer to the [starship_battery](https://github.com/starship/rust-battery) repo/docs.
|
||||
|
||||
use starship_battery::{
|
||||
units::{power::watt, ratio::percent, time::second},
|
||||
Battery, Manager, State,
|
||||
units::{power::watt, ratio::percent, time::second},
|
||||
};
|
||||
|
||||
/// Battery state.
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::io;
|
|||
use hashbrown::HashMap;
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::{keep_disk_entry, DiskHarvest, IoHarvest};
|
||||
use crate::collection::{deserialize_xo, disks::IoData, error::CollectionResult, DataCollector};
|
||||
use super::{DiskHarvest, IoHarvest, keep_disk_entry};
|
||||
use crate::collection::{DataCollector, deserialize_xo, disks::IoData, error::CollectionResult};
|
||||
|
||||
#[derive(Deserialize, Debug, Default)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Fallback disk info using sysinfo.
|
||||
|
||||
use super::{keep_disk_entry, DiskHarvest};
|
||||
use super::{DiskHarvest, keep_disk_entry};
|
||||
use crate::collection::DataCollector;
|
||||
|
||||
pub(crate) fn get_disk_usage(collector: &DataCollector) -> anyhow::Result<Vec<DiskHarvest>> {
|
||||
|
|
|
@ -24,7 +24,7 @@ cfg_if::cfg_if! {
|
|||
use file_systems::*;
|
||||
use usage::*;
|
||||
|
||||
use super::{keep_disk_entry, DiskHarvest};
|
||||
use super::{DiskHarvest, keep_disk_entry};
|
||||
use crate::collection::DataCollector;
|
||||
|
||||
/// Returns the disk usage of the mounted (and for now, physical) disks.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//! Ideally, we can remove this if sysinfo ever gains disk I/O capabilities.
|
||||
|
||||
use core_foundation::{
|
||||
base::{mach_port_t, CFAllocatorRef},
|
||||
base::{CFAllocatorRef, mach_port_t},
|
||||
dictionary::CFMutableDictionaryRef,
|
||||
};
|
||||
use libc::c_char;
|
||||
|
@ -32,8 +32,9 @@ pub const kIOServicePlane: &str = "IOService\0";
|
|||
#[expect(non_upper_case_globals)]
|
||||
pub const kIOMediaClass: &str = "IOMedia\0";
|
||||
|
||||
// See [here](https://developer.apple.com/documentation/iokit) for more details.
|
||||
extern "C" {
|
||||
// SAFETY: Bindings like this are inherently unsafe. See [here](https://developer.apple.com/documentation/iokit) for
|
||||
// more details.
|
||||
unsafe extern "C" {
|
||||
|
||||
pub fn IOServiceGetMatchingServices(
|
||||
mainPort: mach_port_t, matching: CFMutableDictionaryRef, existing: *mut io_iterator_t,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::bail;
|
||||
use mach2::kern_return;
|
||||
|
||||
use super::{bindings::*, IoIterator};
|
||||
use super::{IoIterator, bindings::*};
|
||||
|
||||
pub fn get_disks() -> anyhow::Result<IoIterator> {
|
||||
let mut media_iter: io_iterator_t = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::mem;
|
|||
|
||||
use anyhow::{anyhow, bail};
|
||||
use core_foundation::{
|
||||
base::{kCFAllocatorDefault, CFType, TCFType, ToVoid},
|
||||
base::{CFType, TCFType, ToVoid, kCFAllocatorDefault},
|
||||
dictionary::{
|
||||
CFDictionary, CFDictionaryGetTypeID, CFDictionaryRef, CFMutableDictionary,
|
||||
CFMutableDictionaryRef,
|
||||
|
|
|
@ -5,7 +5,8 @@ use std::io::Error;
|
|||
|
||||
const MNT_NOWAIT: libc::c_int = 2;
|
||||
|
||||
extern "C" {
|
||||
// SAFETY: Bindings like this are inherently unsafe.
|
||||
unsafe extern "C" {
|
||||
fn getfsstat64(buf: *mut libc::statfs, bufsize: libc::c_int, flags: libc::c_int)
|
||||
-> libc::c_int;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ fn partitions_iter() -> anyhow::Result<impl Iterator<Item = Partition>> {
|
|||
let mounts = bindings::mounts()?;
|
||||
|
||||
unsafe fn ptr_to_cow<'a>(ptr: *const i8) -> std::borrow::Cow<'a, str> {
|
||||
CStr::from_ptr(ptr).to_string_lossy()
|
||||
unsafe { CStr::from_ptr(ptr).to_string_lossy() }
|
||||
}
|
||||
|
||||
Ok(mounts.into_iter().map(|stat| {
|
||||
|
|
|
@ -5,8 +5,8 @@ mod bindings;
|
|||
use bindings::*;
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::{keep_disk_entry, DiskHarvest};
|
||||
use crate::collection::{disks::IoCounters, DataCollector};
|
||||
use super::{DiskHarvest, keep_disk_entry};
|
||||
use crate::collection::{DataCollector, disks::IoCounters};
|
||||
|
||||
/// Returns I/O stats.
|
||||
pub(crate) fn io_stats() -> anyhow::Result<Vec<IoCounters>> {
|
||||
|
|
|
@ -11,13 +11,13 @@ use anyhow::bail;
|
|||
use windows::Win32::{
|
||||
Foundation::{self, CloseHandle, HANDLE},
|
||||
Storage::FileSystem::{
|
||||
CreateFileW, FindFirstVolumeW, FindNextVolumeW, FindVolumeClose,
|
||||
GetVolumeNameForVolumeMountPointW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_READ,
|
||||
FILE_SHARE_WRITE, OPEN_EXISTING,
|
||||
CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_READ, FILE_SHARE_WRITE,
|
||||
FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, GetVolumeNameForVolumeMountPointW,
|
||||
OPEN_EXISTING,
|
||||
},
|
||||
System::{
|
||||
Ioctl::{DISK_PERFORMANCE, IOCTL_DISK_PERFORMANCE},
|
||||
IO::DeviceIoControl,
|
||||
Ioctl::{DISK_PERFORMANCE, IOCTL_DISK_PERFORMANCE},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -65,11 +65,7 @@ pub fn zfs_io_stats() -> anyhow::Result<Vec<IoCounters>> {
|
|||
.filter_map(|e| {
|
||||
e.ok().and_then(|d| {
|
||||
let p = d.path();
|
||||
if p.is_dir() {
|
||||
Some(p)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if p.is_dir() { Some(p) } else { None }
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{num::NonZeroU64, sync::OnceLock};
|
|||
|
||||
use hashbrown::HashMap;
|
||||
use nvml_wrapper::{
|
||||
enum_wrappers::device::TemperatureSensor, enums::device::UsedGpuMemory, error::NvmlError, Nvml,
|
||||
Nvml, enum_wrappers::device::TemperatureSensor, enums::device::UsedGpuMemory, error::NvmlError,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
|
@ -34,7 +34,7 @@ cfg_if! {
|
|||
|
||||
use std::{borrow::Cow, time::Duration};
|
||||
|
||||
use super::{error::CollectionResult, DataCollector};
|
||||
use super::{DataCollector, error::CollectionResult};
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_family = "windows")] {
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{io, process::Command};
|
|||
use hashbrown::HashMap;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
|
||||
use crate::collection::{deserialize_xo, processes::UnixProcessExt, Pid};
|
||||
use crate::collection::{Pid, deserialize_xo, processes::UnixProcessExt};
|
||||
|
||||
#[derive(Deserialize, Debug, Default)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
|
|
|
@ -13,8 +13,8 @@ use hashbrown::HashSet;
|
|||
use process::*;
|
||||
use sysinfo::ProcessStatus;
|
||||
|
||||
use super::{process_status_str, Pid, ProcessHarvest, UserTable};
|
||||
use crate::collection::{error::CollectionResult, DataCollector};
|
||||
use super::{Pid, ProcessHarvest, UserTable, process_status_str};
|
||||
use crate::collection::{DataCollector, error::CollectionResult};
|
||||
|
||||
/// Maximum character length of a `/proc/<PID>/stat`` process name.
|
||||
/// If it's equal or greater, then we instead refer to the command for the name.
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
use std::mem;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{Result, bail};
|
||||
use libc::{
|
||||
boolean_t, c_char, c_long, c_short, c_uchar, c_ushort, c_void, dev_t, gid_t, itimerval, pid_t,
|
||||
rusage, sigset_t, timeval, uid_t, xucred, CTL_KERN, KERN_PROC, KERN_PROC_PID, MAXCOMLEN,
|
||||
CTL_KERN, KERN_PROC, KERN_PROC_PID, MAXCOMLEN, boolean_t, c_char, c_long, c_short, c_uchar,
|
||||
c_ushort, c_void, dev_t, gid_t, itimerval, pid_t, rusage, sigset_t, timeval, uid_t, xucred,
|
||||
};
|
||||
use mach2::vm_types::user_addr_t;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::{io, time::Duration};
|
|||
use hashbrown::HashMap;
|
||||
use sysinfo::{ProcessStatus, System};
|
||||
|
||||
use super::{process_status_str, ProcessHarvest};
|
||||
use crate::collection::{error::CollectionResult, processes::UserTable, Pid};
|
||||
use super::{ProcessHarvest, process_status_str};
|
||||
use crate::collection::{Pid, error::CollectionResult, processes::UserTable};
|
||||
|
||||
pub(crate) trait UnixProcessExt {
|
||||
fn sysinfo_process_data(
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use super::{process_status_str, ProcessHarvest};
|
||||
use crate::collection::{error::CollectionResult, DataCollector};
|
||||
use super::{ProcessHarvest, process_status_str};
|
||||
use crate::collection::{DataCollector, error::CollectionResult};
|
||||
|
||||
// TODO: There's a lot of shared code with this and the unix impl.
|
||||
pub fn sysinfo_process_data(
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::sync::mpsc::Sender;
|
|||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind};
|
||||
|
||||
use crate::{
|
||||
app::{layout_manager::WidgetDirection, App},
|
||||
app::{App, layout_manager::WidgetDirection},
|
||||
collection::Data,
|
||||
};
|
||||
|
||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -25,34 +25,32 @@ pub mod widgets;
|
|||
|
||||
use std::{
|
||||
boxed::Box,
|
||||
io::{stderr, stdout, Write},
|
||||
io::{Write, stderr, stdout},
|
||||
panic::{self, PanicHookInfo},
|
||||
sync::{
|
||||
mpsc::{self, Receiver, Sender},
|
||||
Arc,
|
||||
mpsc::{self, Receiver, Sender},
|
||||
},
|
||||
thread::{self, JoinHandle},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use app::{layout_manager::UsedWidgets, App, AppConfigFields, DataFilters};
|
||||
use app::{App, AppConfigFields, DataFilters, layout_manager::UsedWidgets};
|
||||
use crossterm::{
|
||||
cursor::{Hide, Show},
|
||||
event::{
|
||||
poll, read, DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste,
|
||||
EnableMouseCapture, Event, KeyEventKind, MouseEventKind,
|
||||
DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture,
|
||||
Event, KeyEventKind, MouseEventKind, poll, read,
|
||||
},
|
||||
execute,
|
||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
|
||||
};
|
||||
use event::{handle_key_event_or_break, handle_mouse_event, BottomEvent, CollectionThreadEvent};
|
||||
use event::{BottomEvent, CollectionThreadEvent, handle_key_event_or_break, handle_mouse_event};
|
||||
use options::{args, get_or_create_config, init_app};
|
||||
use tui::{backend::CrosstermBackend, Terminal};
|
||||
use utils::cancellation_token::CancellationToken;
|
||||
use utils::conversion::*;
|
||||
|
||||
use tui::{Terminal, backend::CrosstermBackend};
|
||||
#[allow(unused_imports, reason = "this is needed if logging is enabled")]
|
||||
use utils::logging::*;
|
||||
use utils::{cancellation_token::CancellationToken, conversion::*};
|
||||
|
||||
// Used for heap allocation debugging purposes.
|
||||
// #[global_allocator]
|
||||
|
@ -323,7 +321,8 @@ pub fn start_bottom(enable_error_hook: &mut bool) -> anyhow::Result<()> {
|
|||
let cancellation_token = cancellation_token.clone();
|
||||
let cleaning_sender = sender.clone();
|
||||
let offset_wait = Duration::from_millis(app.app_config_fields.retention_ms + 60000);
|
||||
thread::spawn(move || loop {
|
||||
thread::spawn(move || {
|
||||
loop {
|
||||
if cancellation_token.sleep_with_cancellation(offset_wait) {
|
||||
break;
|
||||
}
|
||||
|
@ -331,6 +330,7 @@ pub fn start_bottom(enable_error_hook: &mut bool) -> anyhow::Result<()> {
|
|||
if cleaning_sender.send(BottomEvent::Clean).is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ use std::{
|
|||
};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use config::style::Styles;
|
||||
pub use config::Config;
|
||||
use config::style::Styles;
|
||||
use data::TemperatureType;
|
||||
pub(crate) use error::{OptionError, OptionResult};
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
|
@ -28,7 +28,7 @@ use starship_battery::Manager;
|
|||
|
||||
use self::{
|
||||
args::BottomArgs,
|
||||
config::{layout::Row, IgnoreList, StringOrNum},
|
||||
config::{IgnoreList, StringOrNum, layout::Row},
|
||||
};
|
||||
use crate::{
|
||||
app::{filter::Filter, layout_manager::*, *},
|
||||
|
@ -1009,7 +1009,7 @@ fn get_memory_legend_position(
|
|||
mod test {
|
||||
use clap::Parser;
|
||||
|
||||
use super::{get_time_interval, Config};
|
||||
use super::{Config, get_time_interval};
|
||||
use crate::{
|
||||
app::App,
|
||||
args::BottomArgs,
|
||||
|
@ -1234,10 +1234,10 @@ mod test {
|
|||
fn test_get_config_path_macos() {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::{get_config_path, DEFAULT_CONFIG_FILE_LOCATION};
|
||||
use super::{DEFAULT_CONFIG_FILE_LOCATION, get_config_path};
|
||||
|
||||
// Case three: no previous config, no XDG var.
|
||||
// SAFETY: this is the only test that does this
|
||||
// SAFETY: This is fine, this is just a test, and no other test affects env vars.
|
||||
unsafe {
|
||||
std::env::remove_var("XDG_CONFIG_HOME");
|
||||
}
|
||||
|
@ -1255,7 +1255,10 @@ mod test {
|
|||
}
|
||||
|
||||
// Case two: no previous config, XDG var exists.
|
||||
// SAFETY: This is fine, this is just a test, and no other test affects env vars.
|
||||
unsafe {
|
||||
std::env::set_var("XDG_CONFIG_HOME", "/tmp");
|
||||
}
|
||||
let mut case_2 = PathBuf::new();
|
||||
case_2.push("/tmp");
|
||||
case_2.push(DEFAULT_CONFIG_FILE_LOCATION);
|
||||
|
|
|
@ -25,7 +25,7 @@ use utils::{opt, set_colour, set_colour_list, set_style};
|
|||
use widgets::WidgetStyle;
|
||||
|
||||
use super::Config;
|
||||
use crate::options::{args::BottomArgs, OptionError, OptionResult};
|
||||
use crate::options::{OptionError, OptionResult, args::BottomArgs};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))]
|
||||
|
|
|
@ -4,7 +4,7 @@ use tui::{
|
|||
};
|
||||
|
||||
use super::{color, hex};
|
||||
use crate::options::config::style::{utils::convert_hex_to_color, Styles};
|
||||
use crate::options::config::style::{Styles, utils::convert_hex_to_color};
|
||||
|
||||
impl Styles {
|
||||
pub(crate) fn gruvbox_palette() -> Self {
|
||||
|
|
|
@ -4,7 +4,7 @@ use tui::{
|
|||
};
|
||||
|
||||
use super::{color, hex};
|
||||
use crate::options::config::style::{utils::convert_hex_to_color, Styles};
|
||||
use crate::options::config::style::{Styles, utils::convert_hex_to_color};
|
||||
|
||||
impl Styles {
|
||||
pub(crate) fn nord_palette() -> Self {
|
||||
|
|
|
@ -135,8 +135,8 @@ macro_rules! set_style {
|
|||
match &style {
|
||||
TextStyleConfig::Colour(colour) => {
|
||||
$palette_field = $palette_field.fg(
|
||||
crate::options::config::style::utils::str_to_colour(&colour.0)
|
||||
.map_err(|err| match stringify!($config_location).split_once(".") {
|
||||
crate::options::config::style::utils::str_to_colour(&colour.0).map_err(
|
||||
|err| match stringify!($config_location).split_once(".") {
|
||||
Some((_, loc)) => crate::options::OptionError::config(format!(
|
||||
"Please update 'styles.{loc}.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
|
@ -145,14 +145,23 @@ macro_rules! set_style {
|
|||
"Please update 'styles.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
)),
|
||||
})?
|
||||
},
|
||||
)?,
|
||||
);
|
||||
}
|
||||
TextStyleConfig::TextStyle {color, bg_color, bold, italics} => {
|
||||
TextStyleConfig::TextStyle {
|
||||
color,
|
||||
bg_color,
|
||||
bold,
|
||||
italics,
|
||||
} => {
|
||||
if let Some(fg) = &color {
|
||||
$palette_field = $palette_field.fg(
|
||||
crate::options::config::style::utils::str_to_colour(&fg.0)
|
||||
.map_err(|err| match stringify!($config_location).split_once(".") {
|
||||
$palette_field = $palette_field
|
||||
.fg(crate::options::config::style::utils::str_to_colour(
|
||||
&fg.0,
|
||||
)
|
||||
.map_err(|err| {
|
||||
match stringify!($config_location).split_once(".") {
|
||||
Some((_, loc)) => crate::options::OptionError::config(format!(
|
||||
"Please update 'styles.{loc}.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
|
@ -161,14 +170,17 @@ macro_rules! set_style {
|
|||
"Please update 'styles.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
)),
|
||||
})?
|
||||
);
|
||||
}
|
||||
})?);
|
||||
}
|
||||
|
||||
if let Some(bg) = &bg_color {
|
||||
$palette_field = $palette_field.bg(
|
||||
crate::options::config::style::utils::str_to_colour(&bg.0)
|
||||
.map_err(|err| match stringify!($config_location).split_once(".") {
|
||||
$palette_field = $palette_field
|
||||
.bg(crate::options::config::style::utils::str_to_colour(
|
||||
&bg.0,
|
||||
)
|
||||
.map_err(|err| {
|
||||
match stringify!($config_location).split_once(".") {
|
||||
Some((_, loc)) => crate::options::OptionError::config(format!(
|
||||
"Please update 'styles.{loc}.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
|
@ -177,23 +189,27 @@ macro_rules! set_style {
|
|||
"Please update 'styles.{}' in your config file. {err}",
|
||||
stringify!($field)
|
||||
)),
|
||||
})?
|
||||
);
|
||||
}
|
||||
})?);
|
||||
}
|
||||
|
||||
if let Some(bold) = &bold {
|
||||
if *bold {
|
||||
$palette_field = $palette_field.add_modifier(tui::style::Modifier::BOLD);
|
||||
$palette_field =
|
||||
$palette_field.add_modifier(tui::style::Modifier::BOLD);
|
||||
} else {
|
||||
$palette_field = $palette_field.remove_modifier(tui::style::Modifier::BOLD);
|
||||
$palette_field =
|
||||
$palette_field.remove_modifier(tui::style::Modifier::BOLD);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(italics) = &italics {
|
||||
if *italics {
|
||||
$palette_field = $palette_field.add_modifier(tui::style::Modifier::ITALIC);
|
||||
$palette_field =
|
||||
$palette_field.add_modifier(tui::style::Modifier::ITALIC);
|
||||
} else {
|
||||
$palette_field = $palette_field.remove_modifier(tui::style::Modifier::ITALIC);
|
||||
$palette_field =
|
||||
$palette_field.remove_modifier(tui::style::Modifier::ITALIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{borders::WidgetBorderType, ColorStr, TextStyleConfig};
|
||||
use super::{ColorStr, TextStyleConfig, borders::WidgetBorderType};
|
||||
|
||||
/// General styling for generic widgets.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
|
|
@ -64,20 +64,12 @@ clamp_num_impl!(u8, u16, u32, u64, usize);
|
|||
|
||||
/// Checked log2.
|
||||
pub fn saturating_log2(value: f64) -> f64 {
|
||||
if value > 0.0 {
|
||||
value.log2()
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
if value > 0.0 { value.log2() } else { 0.0 }
|
||||
}
|
||||
|
||||
/// Checked log10.
|
||||
pub fn saturating_log10(value: f64) -> f64 {
|
||||
if value > 0.0 {
|
||||
value.log10()
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
if value > 0.0 { value.log10() } else { 0.0 }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -6,11 +6,11 @@ use tui::widgets::Row;
|
|||
use crate::{
|
||||
app::AppConfigFields,
|
||||
canvas::{
|
||||
Painter,
|
||||
components::data_table::{
|
||||
Column, ColumnHeader, DataTable, DataTableColumn, DataTableProps, DataTableStyling,
|
||||
DataToCell,
|
||||
},
|
||||
Painter,
|
||||
},
|
||||
collection::cpu::{CpuData, CpuDataType},
|
||||
options::config::{cpu::CpuDefault, style::Styles},
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{borrow::Cow, cmp::max, num::NonZeroU16};
|
|||
use serde::Deserialize;
|
||||
|
||||
use crate::{
|
||||
app::{data::StoredData, AppConfigFields},
|
||||
app::{AppConfigFields, data::StoredData},
|
||||
canvas::components::data_table::{
|
||||
ColumnHeader, DataTableColumn, DataTableProps, DataTableStyling, DataToCell, SortColumn,
|
||||
SortDataTable, SortDataTableProps, SortOrder, SortsRow,
|
||||
|
|
|
@ -10,13 +10,13 @@ use indexmap::IndexSet;
|
|||
use itertools::Itertools;
|
||||
pub use process_columns::*;
|
||||
pub use process_data::*;
|
||||
use query::{parse_query, ProcessQuery};
|
||||
use query::{ProcessQuery, parse_query};
|
||||
use sort_table::SortTableColumn;
|
||||
|
||||
use crate::{
|
||||
app::{
|
||||
data::{ProcessData, StoredData},
|
||||
AppConfigFields, AppSearchState,
|
||||
data::{ProcessData, StoredData},
|
||||
},
|
||||
canvas::components::data_table::{
|
||||
Column, ColumnHeader, ColumnWidthBounds, DataTable, DataTableColumn, DataTableProps,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
borrow::Cow,
|
||||
cmp::{max, Ordering},
|
||||
cmp::{Ordering, max},
|
||||
fmt::Display,
|
||||
num::NonZeroU16,
|
||||
time::Duration,
|
||||
|
@ -12,12 +12,12 @@ use tui::widgets::Row;
|
|||
use super::process_columns::ProcColumn;
|
||||
use crate::{
|
||||
canvas::{
|
||||
components::data_table::{DataTableColumn, DataToCell},
|
||||
Painter,
|
||||
components::data_table::{DataTableColumn, DataToCell},
|
||||
},
|
||||
collection::processes::{Pid, ProcessHarvest},
|
||||
dec_bytes_per_second_string,
|
||||
utils::data_units::{get_binary_bytes, get_decimal_bytes, GIBI_LIMIT, GIGA_LIMIT},
|
||||
utils::data_units::{GIBI_LIMIT, GIGA_LIMIT, get_binary_bytes, get_decimal_bytes},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -391,9 +391,8 @@ impl DataToCell<ProcColumn> for ProcWidgetData {
|
|||
mod test {
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::utils::data_units::*;
|
||||
|
||||
use super::*;
|
||||
use crate::utils::data_units::*;
|
||||
|
||||
#[test]
|
||||
fn test_format_time() {
|
||||
|
|
|
@ -329,7 +329,7 @@ pub(crate) fn parse_query(
|
|||
or: None,
|
||||
regex_prefix: Some((prefix_type, StringQuery::Value(content))),
|
||||
compare_prefix: None,
|
||||
})
|
||||
});
|
||||
}
|
||||
PrefixType::Pid | PrefixType::State | PrefixType::User => {
|
||||
// We have to check if someone put an "="...
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::{borrow::Cow, cmp::max, num::NonZeroU16};
|
||||
|
||||
use crate::{
|
||||
app::{data::TypedTemperature, AppConfigFields},
|
||||
app::{AppConfigFields, data::TypedTemperature},
|
||||
canvas::components::data_table::{
|
||||
ColumnHeader, DataTableColumn, DataTableProps, DataTableStyling, DataToCell, SortColumn,
|
||||
SortDataTable, SortDataTableProps, SortOrder, SortsRow,
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{env, ffi::OsString, path::Path, process::Command};
|
|||
|
||||
use hashbrown::HashMap;
|
||||
#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
|
||||
use portable_pty::{native_pty_system, Child, CommandBuilder, MasterPty, PtySize};
|
||||
use portable_pty::{Child, CommandBuilder, MasterPty, PtySize, native_pty_system};
|
||||
|
||||
pub fn abs_path(path: &str) -> OsString {
|
||||
let path = Path::new(path);
|
||||
|
|
Loading…
Reference in New Issue