|
| 1 | +use serde::{Deserialize, Serialize}; |
1 | 2 | use std::fmt::Display; |
2 | 3 | use std::str::FromStr; |
3 | 4 |
|
4 | | -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] |
| 5 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] |
5 | 6 | pub(crate) enum PortState { |
6 | 7 | Active, |
7 | 8 | Down, |
@@ -29,21 +30,21 @@ impl FromStr for PortState { |
29 | 30 | } |
30 | 31 | } |
31 | 32 |
|
32 | | -#[derive(Debug)] |
| 33 | +#[derive(Debug, Serialize, Deserialize)] |
33 | 34 | pub(crate) struct AdapterInfo { |
34 | 35 | pub(crate) name: String, |
35 | 36 | pub(crate) ports: Vec<PortInfo>, |
36 | 37 | } |
37 | 38 |
|
38 | | -#[derive(Debug, Default)] |
| 39 | +#[derive(Debug, Default, Serialize, Deserialize)] |
39 | 40 | pub(crate) struct PortInfo { |
40 | 41 | pub(crate) port_number: u16, |
41 | 42 | pub(crate) state: PortState, |
42 | 43 | pub(crate) rate: String, |
43 | 44 | pub(crate) counters: PortCounters, |
44 | 45 | } |
45 | 46 |
|
46 | | -#[derive(Debug, Default, Clone)] |
| 47 | +#[derive(Debug, Default, Clone, Serialize, Deserialize)] |
47 | 48 | pub(crate) struct PortCounters { |
48 | 49 | pub(crate) rx_bytes: u64, |
49 | 50 | pub(crate) tx_bytes: u64, |
|
0 commit comments