implemented lifetimes properly
This commit is contained in:
@@ -3,7 +3,7 @@ use ratatui::{
|
||||
widgets::{Block, Borders},
|
||||
};
|
||||
|
||||
pub fn entryBox(title: String) -> Block<'static> {
|
||||
pub fn entryBox<'a>(title: &'a str) -> Block<'a> {
|
||||
Block::default()
|
||||
.title(title)
|
||||
.borders(Borders::ALL)
|
||||
|
||||
@@ -9,12 +9,12 @@ use ratatui::{
|
||||
widgets::{Block, Borders, Cell, Row, Table},
|
||||
};
|
||||
|
||||
pub fn getTableElement(
|
||||
entries: &[Entry],
|
||||
pub fn getTableElement<'a>(
|
||||
entries: &'a [Entry],
|
||||
curScreen: &CurrentScreen,
|
||||
appStatus: &AppStatus,
|
||||
isHashDifferent: bool,
|
||||
) -> Table<'static> {
|
||||
) -> Table<'a> {
|
||||
let headers = ["No.", "From IP", "From Port", "-->", "To IP", "To Port"]
|
||||
.into_iter()
|
||||
.map(Cell::from)
|
||||
|
||||
@@ -4,7 +4,7 @@ use ratatui::{
|
||||
widgets::{Block, Borders, Paragraph, Wrap},
|
||||
};
|
||||
|
||||
pub fn getExitPara() -> Paragraph<'static> {
|
||||
pub fn getExitPara<'a>() -> Paragraph<'a> {
|
||||
let exitPopup = Block::default()
|
||||
.title("Exit Window")
|
||||
.borders(Borders::ALL)
|
||||
|
||||
@@ -5,7 +5,7 @@ use ratatui::{
|
||||
|
||||
use crate::app::status::{AppStatus, CurrentScreen, EditingField, EntryValError};
|
||||
|
||||
pub fn getHeaderScreen(scr: &CurrentScreen) -> (Color, Span<'static>) {
|
||||
pub fn getHeaderScreen<'a>(scr: &'a CurrentScreen) -> (Color, Span<'a>) {
|
||||
match scr {
|
||||
CurrentScreen::Main => (
|
||||
Color::LightBlue,
|
||||
@@ -30,7 +30,10 @@ pub fn getHeaderScreen(scr: &CurrentScreen) -> (Color, Span<'static>) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getHeaderStatus(status: &AppStatus, editingField: &Option<EditingField>) -> Span<'static> {
|
||||
pub fn getHeaderStatus<'a>(
|
||||
status: &'a AppStatus,
|
||||
editingField: &'a Option<EditingField>,
|
||||
) -> Span<'a> {
|
||||
match status {
|
||||
AppStatus::Welcome => Span::styled("Welcome", Style::default().fg(Color::White)),
|
||||
AppStatus::Added => Span::styled("Added", Style::default().fg(Color::Green)),
|
||||
|
||||
@@ -94,10 +94,10 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
||||
])
|
||||
.split(area);
|
||||
|
||||
let mut fromIPBlock = entryBox::entryBox("From IP".to_string());
|
||||
let mut toIPBlock = entryBox::entryBox("To IP".to_string());
|
||||
let mut fromPortBlock = entryBox::entryBox("From Port".to_string());
|
||||
let mut toPortBlock = entryBox::entryBox("To Port".to_string());
|
||||
let mut fromIPBlock = entryBox::entryBox("From IP");
|
||||
let mut toIPBlock = entryBox::entryBox("To IP");
|
||||
let mut fromPortBlock = entryBox::entryBox("From Port");
|
||||
let mut toPortBlock = entryBox::entryBox("To Port");
|
||||
let activeStyle = Style::default().bg(Color::LightYellow).fg(Color::Black);
|
||||
|
||||
match edit {
|
||||
|
||||
Reference in New Issue
Block a user