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