summaryrefslogtreecommitdiffstats
path: root/src/widgets/process_table/sort_table.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/process_table/sort_table.rs')
-rw-r--r--src/widgets/process_table/sort_table.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/widgets/process_table/sort_table.rs b/src/widgets/process_table/sort_table.rs
index 5b7a9dbd..e17d62d9 100644
--- a/src/widgets/process_table/sort_table.rs
+++ b/src/widgets/process_table/sort_table.rs
@@ -1,4 +1,4 @@
-use std::borrow::Cow;
+use std::{borrow::Cow, num::NonZeroU16};
use tui::text::Text;
@@ -16,12 +16,8 @@ impl ColumnHeader for SortTableColumn {
}
impl DataToCell<SortTableColumn> for &'static str {
- fn to_cell(&self, _column: &SortTableColumn, calculated_width: u16) -> Option<Text<'_>> {
- if calculated_width == 0 {
- return None;
- }
-
- Some(truncate_to_text(self, calculated_width))
+ fn to_cell(&self, _column: &SortTableColumn, calculated_width: NonZeroU16) -> Option<Text<'_>> {
+ Some(truncate_to_text(self, calculated_width.get()))
}
fn column_widths<C: DataTableColumn<SortTableColumn>>(data: &[Self], _columns: &[C]) -> Vec<u16>
@@ -33,12 +29,8 @@ impl DataToCell<SortTableColumn> for &'static str {
}
impl DataToCell<SortTableColumn> for Cow<'static, str> {
- fn to_cell(&self, _column: &SortTableColumn, calculated_width: u16) -> Option<Text<'_>> {
- if calculated_width == 0 {
- return None;
- }
-
- Some(truncate_to_text(self, calculated_width))
+ fn to_cell(&self, _column: &SortTableColumn, calculated_width: NonZeroU16) -> Option<Text<'_>> {
+ Some(truncate_to_text(self, calculated_width.get()))
}
fn column_widths<C: DataTableColumn<SortTableColumn>>(data: &[Self], _columns: &[C]) -> Vec<u16>