| Crates.io | nm-rs |
| lib.rs | nm-rs |
| version | 0.1.3 |
| created_at | 2026-01-08 13:38:41.445556+00 |
| updated_at | 2026-01-08 14:35:28.943724+00 |
| description | Rust bindings for the libnm library. |
| homepage | https://github.com/Daru-san/nm-rs |
| repository | https://github.com/Daru-san/nm-rs |
| max_upload_size | |
| id | 2030238 |
| size | 36,662,101 |
NetworkManager bindings for Rust.
These expose the NetworkManager library features to Rust for usage in Rust-based applications.
See https://networkmanager.dev/docs/libnm/latest/ for documentation on how to use libnm.
Docs are also available at https://docs.rs/nm-rs.
Ensure the following libraries are installed before building this crate
Below is an example that prints all the devices registered by NetworkManager.
use nm_rs::Client;
use nm_rs::prelude::DeviceExt;
fn print_devices(client: &Client) {
let devices = client.devices();
for device in devices {
let name = device.iface();
println!(
"The network interface {name} is a {:#?} device.",
device.device_type()
);
}
}
fn main() {
let context = glib::MainContext::new();
let mainloop = glib::MainLoop::new(Some(&context), false);
context.spawn_local(glib::clone!(
#[strong]
mainloop,
async move {
let client = match Client::new_future().await {
Ok(client) => client,
Err(e) => {
glib::g_error!("app", "Failed to create new client: {e}");
return;
}
};
print_devices(&client);
mainloop.quit();
}
));
mainloop.run();
}
More examples are available in the examples directory.