synapse_rs/lib.rs
1//! # Synapse
2//!
3//! Standardized network-quality metrics beyond raw speed tests.
4//!
5//! Synapse turns caller-supplied measurements into three scores:
6//!
7//! - **Vortex** — performance / flow (throughput, latency, jitter, loss)
8//! - **Radiance** — wireless physical quality (SNR × channel width)
9//! - **Axon** — unified health (`√(Vortex × Radiance)`, or Vortex alone on wired links)
10//!
11//! This crate does **not** run speed tests or probe the network. You collect
12//! the numbers; Synapse scores them.
13//!
14//! # Quick start
15//!
16//! ```
17//! use synapse_rs::{NetworkData, ScoreBand};
18//!
19//! let data = NetworkData::new()
20//! .with_down_mbps(150.0)
21//! .with_up_mbps(40.0)
22//! .with_ping_ms(18.0)
23//! .with_jitter_ms(2.0)
24//! .with_packet_loss_percent(0.0)
25//! .with_rssi_dbm(-60.0)
26//! .with_noise_dbm(-90.0)
27//! .with_channel_width_mhz(40.0);
28//!
29//! let axon = data.calculate_axon().expect("valid sample");
30//! let band = ScoreBand::from_score(axon);
31//! assert!(axon.is_finite());
32//! assert_ne!(band.as_str(), "");
33//! ```
34//!
35//! # Fallible API
36//!
37//! Prefer `try_*` when you need to distinguish missing fields from invalid
38//! values (`NaN`, negative speeds, RSSI below noise, …):
39//!
40//! ```
41//! use synapse_rs::{NetworkData, SynapseError};
42//!
43//! let data = NetworkData::new().with_down_mbps(-1.0);
44//! assert!(matches!(
45//! data.try_vortex(),
46//! Err(SynapseError::MissingField(_)) | Err(SynapseError::InvalidValue { .. })
47//! ));
48//! ```
49//!
50//! # Feature flags
51//!
52//! - `serde` — derive `Serialize` / `Deserialize` on public types
53
54#![deny(missing_docs)]
55#![warn(clippy::all)]
56
57pub mod error;
58pub mod models;
59
60pub use error::{Result, SynapseError};
61pub use models::{NetworkData, ScoreBand};