Skip to content

Commit

Permalink
fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Sep 17, 2024
1 parent 19eb710 commit 1d30e56
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
8 changes: 6 additions & 2 deletions oryx-tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ pub struct DataEventHandler {
pub handler: thread::JoinHandle<()>,
}

// let x = Protocol::NetworkProtocol(Tcp)

#[derive(Debug, Clone)]
pub struct FilterChannel {
pub sender: kanal::Sender<(Protocol, bool)>,
Expand All @@ -75,6 +73,12 @@ impl FilterChannel {
}
}

impl Default for FilterChannel {
fn default() -> Self {
Self::new()
}
}

#[derive(Debug)]
pub struct App {
pub running: bool,
Expand Down
6 changes: 6 additions & 0 deletions oryx-tui/src/filters/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub struct LinkFilter {
pub applied_protocols: Vec<LinkProtocol>,
}

impl Default for LinkFilter {
fn default() -> Self {
Self::new()
}
}

impl LinkFilter {
pub fn new() -> Self {
Self {
Expand Down
9 changes: 7 additions & 2 deletions oryx-tui/src/filters/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub struct NetworkFilter {
pub applied_protocols: Vec<NetworkProtocol>,
}

impl Default for NetworkFilter {
fn default() -> Self {
Self::new()
}
}

impl NetworkFilter {
pub fn new() -> Self {
NetworkFilter {
Expand All @@ -27,13 +33,12 @@ impl NetworkFilter {
applied_protocols: Vec::new(),
}
}
}

impl NetworkFilter {
pub fn apply(&mut self) {
self.applied_protocols = self.selected_protocols.clone();
self.selected_protocols.clear();
}

pub fn render(&mut self, frame: &mut Frame, block: Rect, focused_block: &FocusedBlock) {
let layout = Layout::default()
.direction(Direction::Horizontal)
Expand Down
6 changes: 5 additions & 1 deletion oryx-tui/src/filters/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ pub struct TransportFilter {
pub applied_protocols: Vec<TransportProtocol>,
}

impl TransportFilter {}
impl Default for TransportFilter {
fn default() -> Self {
Self::new()
}
}

impl TransportFilter {
pub fn new() -> Self {
Expand Down
6 changes: 3 additions & 3 deletions oryx-tui/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ pub fn handle_key_events(
}

for protocol in TransportProtocol::all().iter() {
if app.transport_filter.applied_protocols.contains(&protocol) {
if app.transport_filter.applied_protocols.contains(protocol) {
app.ingress_filter_channel
.sender
.send((Protocol::Transport(*protocol), false))?;
Expand All @@ -629,7 +629,7 @@ pub fn handle_key_events(
}

for protocol in NetworkProtocol::all().iter() {
if app.network_filter.applied_protocols.contains(&protocol) {
if app.network_filter.applied_protocols.contains(protocol) {
app.ingress_filter_channel
.sender
.send((Protocol::Network(*protocol), false))?;
Expand All @@ -647,7 +647,7 @@ pub fn handle_key_events(
}

for protocol in LinkProtocol::all().iter() {
if app.link_filter.applied_protocols.contains(&protocol) {
if app.link_filter.applied_protocols.contains(protocol) {
app.ingress_filter_channel
.sender
.send((Protocol::Link(*protocol), false))?;
Expand Down

0 comments on commit 1d30e56

Please sign in to comment.