Skip to main content

Crate synapse_rs

Crate synapse_rs 

Source
Expand description

§Synapse

Standardized network-quality metrics beyond raw speed tests.

Synapse turns caller-supplied measurements into three scores:

  • Vortex — performance / flow (throughput, latency, jitter, loss)
  • Radiance — wireless physical quality (SNR × channel width)
  • Axon — unified health (√(Vortex × Radiance), or Vortex alone on wired links)

This crate does not run speed tests or probe the network. You collect the numbers; Synapse scores them.

§Quick start

use synapse_rs::{NetworkData, ScoreBand};

let data = NetworkData::new()
    .with_down_mbps(150.0)
    .with_up_mbps(40.0)
    .with_ping_ms(18.0)
    .with_jitter_ms(2.0)
    .with_packet_loss_percent(0.0)
    .with_rssi_dbm(-60.0)
    .with_noise_dbm(-90.0)
    .with_channel_width_mhz(40.0);

let axon = data.calculate_axon().expect("valid sample");
let band = ScoreBand::from_score(axon);
assert!(axon.is_finite());
assert_ne!(band.as_str(), "");

§Fallible API

Prefer try_* when you need to distinguish missing fields from invalid values (NaN, negative speeds, RSSI below noise, …):

use synapse_rs::{NetworkData, SynapseError};

let data = NetworkData::new().with_down_mbps(-1.0);
assert!(matches!(
    data.try_vortex(),
    Err(SynapseError::MissingField(_)) | Err(SynapseError::InvalidValue { .. })
));

§Feature flags

  • serde — derive Serialize / Deserialize on public types

Re-exports§

pub use error::Result;
pub use error::SynapseError;
pub use models::NetworkData;
pub use models::ScoreBand;

Modules§

error
Errors returned when network metrics cannot be computed.
models
Network quality metrics: Vortex, Radiance, and Axon.