Skip to main content

NetworkData

Struct NetworkData 

Source
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

Source

pub const fn new() -> Self

Creates an empty measurement (all fields None).

Source

pub fn with_down_mbps(self, v: f64) -> Self

Builder: download speed in Mbps.

Source

pub fn with_up_mbps(self, v: f64) -> Self

Builder: upload speed in Mbps.

Source

pub fn with_ping_ms(self, v: f64) -> Self

Builder: ping in milliseconds.

Source

pub fn with_jitter_ms(self, v: f64) -> Self

Builder: jitter in milliseconds.

Source

pub fn with_packet_loss_percent(self, v: f64) -> Self

Builder: packet loss percentage.

Source

pub fn with_rssi_dbm(self, v: f64) -> Self

Builder: RSSI in dBm.

Source

pub fn with_noise_dbm(self, v: f64) -> Self

Builder: noise floor in dBm.

Source

pub fn with_channel_width_mhz(self, v: f64) -> Self

Builder: channel width in MHz.

Source

pub fn has_performance_data(&self) -> bool

Returns true when enough fields are present to attempt a Vortex score.

Source

pub fn has_wireless_data(&self) -> bool

Returns true when enough fields are present to attempt a Radiance score.

Source

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 valid
  • None when data is missing or invalid (see Self::try_vortex)
Source

pub fn try_vortex(&self) -> Result<f64>

Fallible Vortex calculation with structured errors.

Source

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 valid
  • None when wired / incomplete / invalid (see Self::try_radiance)
Source

pub fn try_radiance(&self) -> Result<f64>

Fallible Radiance calculation with structured errors.

Source

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 computed
  • None when performance data is missing or invalid
Source

pub fn try_axon(&self) -> Result<f64>

Fallible Axon calculation with structured errors.

Trait Implementations§

Source§

impl Clone for NetworkData

Source§

fn clone(&self) -> NetworkData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NetworkData

Source§

impl Debug for NetworkData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NetworkData

Source§

fn default() -> NetworkData

Returns the “default value” for a type. Read more
Source§

impl PartialEq for NetworkData

Source§

fn eq(&self, other: &NetworkData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NetworkData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.