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)
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.

VPN Types

TypeDescription
VpnTypeVPN protocol: WireGuard
VpnCredentialsFull VPN configuration for connecting
VpnCredentialsBuilderBuilder for VpnCredentials
WireGuardPeerWireGuard peer configuration
VpnConnectionA saved/active VPN connection
VpnConnectionInfoDetailed VPN info (IP, DNS, gateway)

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
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,
    WifiSecurity, EapOptions, EapMethod, Phase2,
    VpnCredentials, VpnType, WireGuardPeer,
    TimeoutConfig, ConnectionOptions,
    ConnectionError, DeviceType, DeviceState,
};
}

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, IpConfig, Route};
}