pub struct NetworkStatus {
pub online: bool,
pub kind: NetworkKind,
pub expensive: Option<bool>,
}Expand description
A snapshot of the device’s network connectivity.
Fields§
§online: boolWhether the device currently has a usable network connection. On Apple platforms this is reachability of the default route (traffic would flow without user intervention) — it does not probe the internet; Android reports the system’s validated-connectivity verdict; Linux reports link-level “an interface is up”.
kind: NetworkKindThe connection’s transport class. Best-effort: exact on Android/HarmonyOS/Linux(-by-name);
on iOS only cellular-vs-not is known (non-cellular reports NetworkKind::Wifi); macOS and
Windows report NetworkKind::Other when online.
expensive: Option<bool>Whether the connection is metered/expensive, where the platform reports it (Android’s
NOT_METERED capability, HarmonyOS likewise, Windows’ cost hint, iOS cellular). None when
unknown.
Trait Implementations§
Source§impl Clone for NetworkStatus
impl Clone for NetworkStatus
Source§fn clone(&self) -> NetworkStatus
fn clone(&self) -> NetworkStatus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkStatus
impl Debug for NetworkStatus
Source§impl PartialEq for NetworkStatus
impl PartialEq for NetworkStatus
Source§fn eq(&self, other: &NetworkStatus) -> bool
fn eq(&self, other: &NetworkStatus) -> bool
self and other values to be equal, and is used by ==.