Core Types

This page lists the primary types exported by nmrs. For complete API documentation, see docs.rs/nmrs.

NetworkManager

The main entry point for all operations.

#![allow(unused)]
fn main() {
use nmrs::NetworkManager;

let nm = NetworkManager::new().await?;
let nm = NetworkManager::with_config(config).await?;
}
  • Clone — clones share the same D-Bus connection
  • Send + Sync — safe to share across tasks
  • See NetworkManager API for all methods

Result Type

#![allow(unused)]
fn main() {
pub type Result<T> = std::result::Result<T, ConnectionError>;
}

All public methods return nmrs::Result<T>.

Wi-Fi Types

TypeDescription
NetworkA discovered Wi-Fi network (SSID, signal, security flags)
NetworkInfoDetailed network information (channel, speed, bars)
AccessPointA single AP with BSSID, frequency, and security flags
WifiDeviceA Wi-Fi device with interface, MAC, state, and active SSID
WifiScopePer-interface operations scope (from nm.wifi("wlan1"))
WifiSecurityAuthentication type: Open, WpaPsk, WpaEap
EapOptionsEnterprise Wi-Fi (802.1X) configuration
EapOptionsBuilderBuilder for EapOptions
EapMethodOuter EAP method: Peap, Ttls
Phase2Inner auth method: Mschapv2, Pap

Device Types

TypeDescription
DeviceA network device (interface, type, state, MAC)
DeviceIdentityDevice MAC addresses (permanent and current)
DeviceTypeDevice kind: Wifi, Ethernet, Bluetooth, WifiP2P, Loopback, Other(u32)
DeviceStateOperational state: Disconnected, Activated, Failed, etc.

Radio / Airplane-Mode Types

TypeDescription
RadioStateCombined software (enabled) and hardware (hardware_enabled) radio state
AirplaneModeStateAggregated state across Wi-Fi, WWAN, and Bluetooth

VPN Types

TypeDescription
VpnConfigSealed trait for VPN configurations
VpnConfigurationDispatch enum: WireGuard(WireGuardConfig) or OpenVpn(OpenVpnConfig)
WireGuardConfigWireGuard VPN configuration
WireGuardPeerWireGuard peer configuration
OpenVpnConfigOpenVPN configuration
OpenVpnAuthTypeOpenVPN auth: Password, Tls, PasswordTls, StaticKey
OpenVpnCompressionCompression mode: No, Lzo (deprecated), Lz4, Lz4V2, Yes
OpenVpnProxyProxy: Http { ... }, Socks { ... }
VpnRouteStatic IPv4 route for split tunneling
VpnTypeProtocol-specific metadata (data-carrying enum)
VpnKindPlugin (OpenVPN, etc.) vs WireGuard
VpnConnectionA saved/active VPN connection with rich metadata
VpnConnectionInfoDetailed active VPN info (IP, DNS, gateway, protocol details)
VpnDetailsProtocol-specific active connection details
VpnCredentialsDeprecated — use WireGuardConfig instead

Connectivity Types

TypeDescription
ConnectivityStateNM connectivity: Full, Portal, Limited, None, Unknown
ConnectivityReportFull report with state, check URI, and captive portal URL
NetworkSnapshotPoint-in-time applet state
AppletNetworkSummaryApplet-ready summary derived from a snapshot
WifiNetworkGroupVisible APs grouped by interface and SSID

Saved Connection Types

TypeDescription
SavedConnectionFull decoded saved profile
SavedConnectionBriefLightweight profile (uuid, id, type)
SavedVpnSummaryLightweight saved VPN status keyed by UUID
SettingsSummaryDecoded settings within a profile
SettingsPatchPartial update for update_saved_connection

Bluetooth Types

TypeDescription
BluetoothDeviceA Bluetooth device with BlueZ info
BluetoothIdentityBluetooth MAC + network role for connecting
BluetoothNetworkRoleRole: PanU, Dun

Configuration Types

TypeDescription
TimeoutConfigConnection/disconnection timeouts
ConnectionOptionsAutoconnect, priority, retry settings

Error Types

TypeDescription
ConnectionErrorAll possible error variants
StateReasonDevice state reason codes
ConnectionStateReasonActivation/deactivation reason codes
ActiveConnectionStateConnection lifecycle states

Builder Types

TypeDescription
ConnectionBuilderBase connection settings builder
WifiConnectionBuilderWi-Fi connection builder
WireGuardBuilderWireGuard VPN builder
OpenVpnBuilderOpenVPN builder (also imports .ovpn files)
IpConfigIP address with CIDR prefix
RouteStatic route configuration
WifiBandWi-Fi band: Bg (2.4 GHz), A (5 GHz)
WifiModeWi-Fi mode: Infrastructure, Adhoc, Ap

Re-exports

nmrs re-exports commonly used types at the crate root for convenience:

#![allow(unused)]
fn main() {
use nmrs::{
    NetworkManager, WifiScope,
    WifiSecurity, EapOptions, EapMethod, Phase2,
    WireGuardConfig, WireGuardPeer,
    OpenVpnConfig, OpenVpnAuthType,
    VpnConfig, VpnConfiguration, VpnType, VpnKind,
    TimeoutConfig, ConnectionOptions,
    ConnectionError, DeviceType, DeviceState,
    RadioState, AirplaneModeState,
    ConnectivityState, ConnectivityReport,
};
}

Less commonly used types are available through the models and builders modules:

#![allow(unused)]
fn main() {
use nmrs::models::{BluetoothIdentity, BluetoothNetworkRole, BluetoothDevice};
use nmrs::builders::{ConnectionBuilder, WireGuardBuilder, OpenVpnBuilder, IpConfig, Route};
}