Skip to content

Commit

Permalink
fixing overview page lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Sep 21, 2024
1 parent 2772510 commit 8eafae4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/gui/pages/inspect_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::utils::types::icon::Icon;
use crate::{ConfigSettings, Language, ReportSortType, RunningPage, Sniffer, StyleType};

/// Computes the body of gui inspect page
pub fn inspect_page<'a>(sniffer: &Sniffer) -> Container<'a, Message, StyleType> {
pub fn inspect_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down Expand Up @@ -103,7 +103,7 @@ pub fn inspect_page<'a>(sniffer: &Sniffer) -> Container<'a, Message, StyleType>
Container::new(Column::new().push(tab_and_body.push(body))).height(Length::Fill)
}

fn lazy_report(sniffer: &Sniffer) -> Column<Message, StyleType> {
fn lazy_report(sniffer: &Sniffer) -> Column<'static, Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down
50 changes: 27 additions & 23 deletions src/gui/pages/overview_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use crate::utils::types::icon::Icon;
use crate::{ByteMultiple, ChartType, ConfigSettings, Language, RunningPage, StyleType};

/// Computes the body of gui overview page
pub fn overview_page<'a>(sniffer: &'a Sniffer) -> Container<'a, Message, StyleType> {
pub fn overview_page(sniffer: &Sniffer) -> Container<Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down Expand Up @@ -141,12 +141,12 @@ pub fn overview_page<'a>(sniffer: &'a Sniffer) -> Container<'a, Message, StyleTy
Container::new(Column::new().push(tab_and_body.push(body))).height(Length::Fill)
}

fn body_no_packets<'a>(
fn body_no_packets(
device: &MyDevice,
font: Font,
language: Language,
waiting: &str,
) -> Column<'a, Message, StyleType> {
) -> Column<'static, Message, StyleType> {
let link_type = device.link_type;
let mut adapter_info = device.name.clone();
adapter_info.push_str(&format!("\n{}", link_type.full_print_on_one_line(language)));
Expand Down Expand Up @@ -186,14 +186,14 @@ fn body_no_packets<'a>(
.push(Space::with_height(FillPortion(2)))
}

fn body_no_observed<'a>(
filters: &'a Filters,
fn body_no_observed(
filters: &Filters,
observed: u128,
font: Font,
font_headers: Font,
language: Language,
waiting: &str,
) -> Column<'a, Message, StyleType> {
) -> Column<'static, Message, StyleType> {
let tot_packets_text = some_observed_translation(language, observed)
.align_x(Alignment::Center)
.font(font);
Expand All @@ -218,12 +218,12 @@ fn body_no_observed<'a>(
.push(Space::with_height(FillPortion(2)))
}

fn body_pcap_error<'a>(
pcap_error: &'a str,
fn body_pcap_error(
pcap_error: &str,
waiting: &str,
language: Language,
font: Font,
) -> Column<'a, Message, StyleType> {
) -> Column<'static, Message, StyleType> {
// let err_string = pcap_error.clone().unwrap();
let error_text = error_translation(language, pcap_error)
.align_x(Alignment::Center)
Expand All @@ -242,7 +242,7 @@ fn body_pcap_error<'a>(
.push(Space::with_height(FillPortion(2)))
}

fn lazy_row_report<'a>(sniffer: &Sniffer) -> Container<'a, Message, StyleType> {
fn lazy_row_report(sniffer: &Sniffer) -> Container<'static, Message, StyleType> {
let col_host = col_host(840.0, sniffer);
let col_service = col_service(250.0, sniffer);

Expand All @@ -257,7 +257,7 @@ fn lazy_row_report<'a>(sniffer: &Sniffer) -> Container<'a, Message, StyleType> {
.class(ContainerType::BorderedRound)
}

fn col_host(width: f32, sniffer: &Sniffer) -> Column<Message, StyleType> {
fn col_host(width: f32, sniffer: &Sniffer) -> Column<'static, Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down Expand Up @@ -362,7 +362,7 @@ fn col_host(width: f32, sniffer: &Sniffer) -> Column<Message, StyleType> {
)
}

fn col_service(width: f32, sniffer: &Sniffer) -> Column<Message, StyleType> {
fn col_service(width: f32, sniffer: &Sniffer) -> Column<'static, Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down Expand Up @@ -442,12 +442,12 @@ fn col_service(width: f32, sniffer: &Sniffer) -> Column<Message, StyleType> {
)
}

fn lazy_col_info<'a>(
fn lazy_col_info(
total: u128,
filtered: u128,
dropped: u32,
sniffer: &Sniffer,
) -> Container<'a, Message, StyleType> {
) -> Container<'static, Message, StyleType> {
let ConfigSettings {
style, language, ..
} = sniffer.configs.lock().unwrap().settings;
Expand Down Expand Up @@ -539,7 +539,11 @@ fn container_chart(sniffer: &Sniffer, font: Font) -> Container<Message, StyleTyp
.class(ContainerType::BorderedRound)
}

fn col_device(language: Language, font: Font, device: &MyDevice) -> Column<Message, StyleType> {
fn col_device(
language: Language,
font: Font,
device: &MyDevice,
) -> Column<'static, Message, StyleType> {
let link_type = device.link_type;
#[cfg(not(target_os = "windows"))]
let adapter_info = &device.name;
Expand All @@ -557,11 +561,11 @@ fn col_device(language: Language, font: Font, device: &MyDevice) -> Column<Messa
.push(link_type.link_type_col(language, font))
}

fn col_data_representation<'a>(
fn col_data_representation(
language: Language,
font: Font,
chart_type: ChartType,
) -> Column<'a, Message, StyleType> {
) -> Column<'static, Message, StyleType> {
let mut ret_val = Column::new().spacing(5).push(
Text::new(format!("{}:", data_representation_translation(language)))
.class(TextType::Subtitle)
Expand Down Expand Up @@ -599,7 +603,7 @@ fn col_bytes_packets(
font: Font,
font_headers: Font,
sniffer: &Sniffer,
) -> Column<Message, StyleType> {
) -> Column<'static, Message, StyleType> {
let filtered_bytes = sniffer.runtime_data.tot_out_bytes + sniffer.runtime_data.tot_in_bytes;
let all_bytes = sniffer.runtime_data.all_bytes;
let filters = &sniffer.filters;
Expand Down Expand Up @@ -724,7 +728,7 @@ fn get_bars_length(
(in_len, out_len)
}

fn get_bars<'a>(in_len: f32, out_len: f32) -> Row<'a, Message, StyleType> {
fn get_bars(in_len: f32, out_len: f32) -> Row<'static, Message, StyleType> {
Row::new()
.push(if in_len > 0.0 {
Row::new()
Expand All @@ -742,7 +746,7 @@ fn get_bars<'a>(in_len: f32, out_len: f32) -> Row<'a, Message, StyleType> {
})
}

fn get_star_button<'a>(is_favorite: bool, host: Host) -> Button<'a, Message, StyleType> {
fn get_star_button(is_favorite: bool, host: Host) -> Button<'static, Message, StyleType> {
button(
Icon::Star
.to_text()
Expand All @@ -767,7 +771,7 @@ fn get_active_filters_col(
font: Font,
font_headers: Font,
show: bool,
) -> Column<Message, StyleType> {
) -> Column<'static, Message, StyleType> {
let mut ret_val = Column::new().push(
Text::new(format!("{}:", active_filters_translation(language),))
.font(font)
Expand Down Expand Up @@ -804,10 +808,10 @@ fn get_active_filters_col(
ret_val
}

fn sort_arrows<'a>(
fn sort_arrows(
active_sort_type: SortType,
message: fn(SortType) -> Message,
) -> Container<'a, Message, StyleType> {
) -> Container<'static, Message, StyleType> {
Container::new(
button(
active_sort_type
Expand Down

0 comments on commit 8eafae4

Please sign in to comment.