pub struct NetworkData {
pub down_mbps: Option<f64>,
pub up_mbps: Option<f64>,
pub ping_ms: Option<f64>,
pub jitter_ms: Option<f64>,
pub packet_loss_percent: Option<f64>,
pub rssi_dbm: Option<f64>,
pub noise_dbm: Option<f64>,
pub channel_width_mhz: Option<f64>,
}Expand description
Represents raw network connection measurements.
All fields are optional so partial snapshots are valid (e.g. Ethernet without Wi-Fi signal data, or signal-only samples without a speed test).
§Field units
- Speeds: Mbps
- Latency / jitter: milliseconds
- Packet loss: percent (
0.0..=100.0) - RSSI / noise: dBm (typically negative)
- Channel width: MHz (
20,40,80,160, …)
Fields§
§down_mbps: Option<f64>Download speed in Mbps.
up_mbps: Option<f64>Upload speed in Mbps.
ping_ms: Option<f64>Round-trip latency in milliseconds.
jitter_ms: Option<f64>Latency variation (jitter) in milliseconds.
packet_loss_percent: Option<f64>Packet loss percentage (0.0 for none, 100.0 for total loss).
rssi_dbm: Option<f64>Received Signal Strength Indicator in dBm (e.g. -65.0). Wireless only.
noise_dbm: Option<f64>Noise floor in dBm (e.g. -90.0). Wireless only.
channel_width_mhz: Option<f64>Wi-Fi channel width in MHz (e.g. 20, 40, 80, 160).
Implementations§
Source§impl NetworkData
impl NetworkData
Sourcepub fn with_down_mbps(self, v: f64) -> Self
pub fn with_down_mbps(self, v: f64) -> Self
Builder: download speed in Mbps.
Sourcepub fn with_up_mbps(self, v: f64) -> Self
pub fn with_up_mbps(self, v: f64) -> Self
Builder: upload speed in Mbps.
Sourcepub fn with_ping_ms(self, v: f64) -> Self
pub fn with_ping_ms(self, v: f64) -> Self
Builder: ping in milliseconds.
Sourcepub fn with_jitter_ms(self, v: f64) -> Self
pub fn with_jitter_ms(self, v: f64) -> Self
Builder: jitter in milliseconds.
Sourcepub fn with_packet_loss_percent(self, v: f64) -> Self
pub fn with_packet_loss_percent(self, v: f64) -> Self
Builder: packet loss percentage.
Sourcepub fn with_rssi_dbm(self, v: f64) -> Self
pub fn with_rssi_dbm(self, v: f64) -> Self
Builder: RSSI in dBm.
Sourcepub fn with_noise_dbm(self, v: f64) -> Self
pub fn with_noise_dbm(self, v: f64) -> Self
Builder: noise floor in dBm.
Sourcepub fn with_channel_width_mhz(self, v: f64) -> Self
pub fn with_channel_width_mhz(self, v: f64) -> Self
Builder: channel width in MHz.
Sourcepub fn has_performance_data(&self) -> bool
pub fn has_performance_data(&self) -> bool
Returns true when enough fields are present to attempt a Vortex score.
Sourcepub fn has_wireless_data(&self) -> bool
pub fn has_wireless_data(&self) -> bool
Returns true when enough fields are present to attempt a Radiance score.
Sourcepub fn calculate_vortex(&self) -> Option<f64>
pub fn calculate_vortex(&self) -> Option<f64>
Calculates the Vortex score (flow / performance).
Combines logarithmic throughput volume with latency friction, then applies a packet-loss integrity factor:
volume = log10(1 + down) * log10(1 + up)
friction = ping_s + 3 * jitter_s + ε
integrity = clamp(1 - loss/100, 0, 1)^10
vortex = (volume / friction) * integrity§Returns
Some(score)when all performance fields are present and validNonewhen data is missing or invalid (seeSelf::try_vortex)
Sourcepub fn try_vortex(&self) -> Result<f64>
pub fn try_vortex(&self) -> Result<f64>
Fallible Vortex calculation with structured errors.
Sourcepub fn calculate_radiance(&self) -> Option<f64>
pub fn calculate_radiance(&self) -> Option<f64>
Calculates the Radiance score (wireless physical quality).
snr = rssi_dbm - noise_dbm
radiance = max(0, (channel_width_mhz / 20) * snr)§Returns
Some(score)when wireless fields are present and validNonewhen wired / incomplete / invalid (seeSelf::try_radiance)
Sourcepub fn try_radiance(&self) -> Result<f64>
pub fn try_radiance(&self) -> Result<f64>
Fallible Radiance calculation with structured errors.
Sourcepub fn calculate_axon(&self) -> Option<f64>
pub fn calculate_axon(&self) -> Option<f64>
Calculates the Axon unified health score.
- Wireless (Vortex + Radiance available): geometric mean
sqrt(vortex * radiance). - Wired (Vortex only): returns the Vortex score so Ethernet links still get a health metric.
§Returns
Some(score)when at least Vortex can be computedNonewhen performance data is missing or invalid
Trait Implementations§
Source§impl Clone for NetworkData
impl Clone for NetworkData
Source§fn clone(&self) -> NetworkData
fn clone(&self) -> NetworkData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more