Skip to content

Commit

Permalink
Pass view mode to ItemSource::connectors().
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Aug 12, 2024
1 parent 21a0c97 commit 9da0e86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,10 @@ pub trait ItemSource<Item, ViewMode> {
item: &Item,
detail: bool)
-> Result<String, Error>;
fn connectors(&mut self, item: &Item) -> Result<String, Error>;
fn connectors(&mut self,
view_mode: ViewMode,
item: &Item)
-> Result<String, Error>;
fn timestamp(&mut self, item: &Item) -> Result<Timestamp, Error>;
}

Expand Down Expand Up @@ -1565,7 +1568,7 @@ impl ItemSource<TrafficItem, TrafficViewMode> for CaptureReader {
})
}

fn connectors(&mut self, item: &TrafficItem)
fn connectors(&mut self, _view_mode: TrafficViewMode, item: &TrafficItem)
-> Result<String, Error>
{
use EndpointState::*;
Expand Down Expand Up @@ -1887,7 +1890,9 @@ impl ItemSource<DeviceItem, ()> for CaptureReader {
})
}

fn connectors(&mut self, item: &DeviceItem) -> Result<String, Error> {
fn connectors(&mut self, _view_mode: (), item: &DeviceItem)
-> Result<String, Error>
{
use DeviceItem::*;
let depth = match item {
Device(..) => 0,
Expand Down
2 changes: 1 addition & 1 deletion src/tree_list_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ where Item: 'static + Copy + Debug,

pub fn connectors(&self, item: &Item) -> String {
let mut cap = self.capture.borrow_mut();
match cap.connectors(item) {
match cap.connectors(self.view_mode, item) {
Ok(string) => string,
Err(e) => format!("Error: {e:?}")
}
Expand Down

0 comments on commit 9da0e86

Please sign in to comment.